Professional Documents
Culture Documents
Programming languages
Program Execution
Why java?
Java History-versions-editions
Java characteristics
Anatomy of java program
Programs
3
…
ADDF3 R1, R2, R3
Assembler …
1101101010011010
…
…
Programming Languages
Machine Language Assembly Language
6 High-Level Language
Programmer
Writes a program in source code.
Compiler
Converts source code to machine language code.
Linker
Combines machine language with libraries and converts them
to an executable file.
Interpreter
Converts source code to machine language and executes one
line at a time.
8
Popular High-Level Languages
9
Result
Runtime
Compile-time Environment Class
Environment Java
Loader
Class
Bytecode Libraries
Java Verifier
Source
(.java)
Just in
Java
Time
Interpreter Java
Java Compiler
Bytecodes Virtual
Java move locally machine
Compiler or through
network
Runtime System
Java
Bytecod Operating System
e
(.class )
Hardware
Why Java?
15
Source
IMPORTANT NOTE: To run the program from the Run button,
set path=“c:\Program Files\java\jdk1.5.0\bin”
Run
Web application
17
PDA and Cell Phone
18
Java’s History
19
James Gosling and Sun Microsystems
Oak
Java, May 20, 1995, Sun World Official release as Java –
Internet
1999 split into J2SE and J2EE
2000 J2ME
HotJava
The first Java-enabled Web browser
JDK Versions
20
Version Release date
JDK Beta 1995
JDK 1.0 January 1996
JDK 1.1 February 1997
J2SE 1.2 December 1998
J2SE 1.3 May 2000
J2SE 1.4 February 2002
J2SE 5.0 September 2004
Java SE 6 December 2006
Java SE 7 July 2011
Java SE 8 (LTS) March 2014
Java SE 9 September 2017
Java SE 10 March 2018
Java SE 11 (LTS) September 2018
Java SE 12 March 2019
Java SE 13 17 September 2019
JDK Editions
21
JBuilder Borland
NetBeans Open Source by Sun
Sun ONE Studio by Sun MicroSystems
Eclipse Open Source by IBM
Characteristics of Java
23
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-Neutral
Java Is Portable
Java Is Multithreaded
Java Is Dynamic
Characteristics of Java
24
JAVA COMPILER
(translator)
JAVA INTERPRETER
(one for each different system)
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-Neutral
Java Is Portable • They can be run on any platform
Java Is Multithreaded without being recompiled.
Java Is Dynamic
33
Characteristics of Java
34
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-
Neutral
Multithread programming is smoothly
Java Is Portable
integrated in Java, whereas in other
Java Is Multithreaded languages you have to call procedures
specific to the operating system to enable
Java Is Dynamic
multithreading.
Characteristics of Java
35
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-
Neutral
Java Is Portable
Java Is Multithreaded • Java was designed to adapt to an evolving
Java Is Dynamic environment.
• New code can be loaded on the fly without
recompilation.
Anatomy of a Java Program
36
• Comments
• Indentation and spacing lines
• Reserved words
• Naming conventions
• Modifiers
• Statements
• Blocks
• Classes
• Methods
• The main method
• Package
Comments
37
• Indentation
• Indent two spaces.
• Spacing
• Use blank line to separate segments of the code.
Reserved Words
40
Welcome
• Class names:
• Capitalize the first letter of each word in the name.
Example: ComputeArea.
• Constants:
• Capitalize all letters in constants, and use underscores
to connect words. Example: PI and
MAX_VALUE
Modifiers
44
Welcome
End-of-line
style
public class Test {
public static void main(String[] args) {
System.out.println("Block Styles");
}
}
Classes
48
[“public”]
[“abstract”|”final”] “class”
ClassName [“extends”
SuperClassName] [“implements”
InterfaceName]
{
}
Method
java.lang
java.util
java.io
java.awt
java.awt.image
java.applet
java.net
53
JVM is a _____________ .
A Compiler
B Debugger
C Assembler
D Interpreter
68