Chap 01
Chap 01
Java Basics
Incheon Paik
Java
James Gosling, Arthur Van Hoff, Andy Bechtolsheim
Binary
File
Compiler(Pentium) Pentium
Source Binary
Code File
Compiler(PowerPC) PowerPC
Binary
%cc Hello.c –o Hello File
% Hello Compiler(SPARC) SPARC
Java
Interpreter
Java Compiler
(Pentium) Pentium
Java Java
Java
Code ByteCode
Interpreter
(Independent on
Java Compiler Platform)
PowerPC
(PowerPC)
Java
%javac Hello.java Interpreter
Hello.class created
Applet
Program running in Web Browser Environment
th JVM
Instance of Class
Class
Template of Creating Object
Inheritance
Inherit the data and methods of parent class
Polymorphism
Shape getArea()
Shape Obj = new Ellipse();
Obj.getArea();
getArea()
getArea() getArea()
Running Environment
Run
% java Hello % hello
Value assignments
varName = value;
+= -= *= /= %=
++ --
j += 6; j = j + 6;
double float
Yes No
float long
Yes No
long int
Type Casting
*/
type VarName[]
int ia[];
varName.length
Example 1.15
type VarName[][];
float fa[][];
varName[index].length
Example 1.16
50 Java Keywords
abstract double int super
boolean else interface switch
break extendslong synchronized
byte final native this
case finally new throw
catch float package throws
char for private transient*
class goto* protected try
const* if public void
continue implements return volatile
default import short while
do instanceof static strictfp
assert (New in 1.5) enum (New in 1.5)
The “assert” is recognized as keyword in JDK1.4 compiler, but we could not use it.
It can be used it from 1.5.
Step 4 (Array)
Refer to this lecture (slide #22)