* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 1
Survey
Document related concepts
Abstraction (computer science) wikipedia , lookup
Name mangling wikipedia , lookup
Functional programming wikipedia , lookup
Falcon (programming language) wikipedia , lookup
Programming language wikipedia , lookup
Go (programming language) wikipedia , lookup
Library (computing) wikipedia , lookup
Reactive programming wikipedia , lookup
Interpreter (computing) wikipedia , lookup
Scala (programming language) wikipedia , lookup
Object-oriented programming wikipedia , lookup
Structured programming wikipedia , lookup
Java (programming language) wikipedia , lookup
Transcript
Java Programming: From Problem Analysis to Program Design, Second Edition D.S. Malik Chapter 1: An Overview of Computers and Programming Languages Java Programming: From Problem Analysis to Program Design, 2 Evolution of Programming Languages High-level languages make programming easier. Closer to spoken languages. Examples: Basic FORTRAN COBOL C/C++ Java Java Programming: From Problem Analysis to Program Design, Second Edition 3 History Of Java Developed by Sun Microsystems – a company known for its workstations . Java is well known for developing internet applications. it is used to : Create web pages with dynamic and interactive content . Develop large –scale enterprise applications. Enhance the functionality of WWW servers . Provide applications for customer devices ( ex . Cell phones) . Java program can run from a web browser. Java Programming: From Problem Analysis to Program Design, Second Edition 4 Basics of Java Environment The environment The language Java applications programming Interface AP Various class libraries Java Programming: From Problem Analysis to Program Design, Second Edition 5 Processing a Java Program Java program undergoes several stages : 1. Editing : use java code and save in a text file named className .java ( source program ). 2. Compiling : the compiler checks the source program for any syntax errors then translates the program into code understood by interpreter called bytecode saved in a file named className.class 3. Loading : the .class file must be loaded into computer main memory for execution and connect all classes. 4. Verifying : to validate and secure against damage . 5. Interprinting :the Interpreter Reads and translates each bytecode instruction into machine language and then executes it , one instrucion at a time . Java Programming: From Problem Analysis to Program Design, Second Edition 6 Processing a Java Program Java Programming: From Problem Analysis to Program Design, Second Edition 7 Processing a Java Program Java Virtual Machine (JVM): A hypothetical computer developed to make Java programs machine independent ( i.e run on many different types of computer platforms ). Bytecode is the machine language for the JVM . Java Programming: From Problem Analysis to Program Design, Second Edition 8 Processing a Java Program Two types of Java programs: applications : standalone programs stored and executed on a local computer . applets : a small program stored on a remote computer that users connect to via a WWW browser. applets are loaded into the browser , executed then discarded . Java Programming: From Problem Analysis to Program Design, Second Edition 9 Example of a Java Program A simple java application: an application executes using the java interpreter. Example : // This prints a line of text public class Welcome { public static void main (String args[] ) { System.out.println(“ welcome to java”) ; } } Java Programming: From Problem Analysis to Program Design, Second Edition 10 Example of a Java Program // single line comment /* */ multiple line comment Every java program must have at least one class . Each class begins with a class declaration that defines data and methods for the class . The class name here is Welcome , and contains a method main () Welcome is an identifier. Java Programming: From Problem Analysis to Program Design, Second Edition 11