Download presentation
Presentation is loading. Please wait.
1
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C, … Intended to be a safe programming language for the Internet Common choice for first programming language Object oriented Encourages good programming habits Very popular commercially Simpler and more elegant than C++, but similar to it Cool
2
Slide 2 of 40. Lecture A Hello World Program // My First Program!! public class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); }
3
Slide 3 of 40. Lecture A Java Program Elements Words Keywords Identifiers Constants Numbers Strings Symbols ( ) [ ] { },. ; + - * / Comments
4
Slide 4 of 40. Lecture A Java Elements // My First Program!! public class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } Comment Identifier Symbols Keywords String Constant
5
Slide 5 of 40. Lecture A Java Program Structure A program is composed of a collection of classes Each class contains a collection of methods Each method is composed of a sequence of instructions (commands, statements)
6
Slide 6 of 40. Lecture A Java Program Structure // My First Program!! public class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } Class Method Instruction
7
Slide 7 of 40. Lecture A Running a Java Program Use an editor to enter (type) the program Save to a file named HelloWorld.java Use the compiler to translate the program into bytecode javac HelloWorld.java This produces a file named HelloWorld.class Run the program using the Interpreter java HelloWorld
8
Slide 8 of 40. Lecture A Java Compilation Compiler Xxx.java Xxx.class Interpreter Output
9
Slide 9 of 40. Lecture A Entering a Java Program into an Editor
10
Slide 10 of 40. Lecture A Running a Java Program
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.