Java Java java ISS, Wuhan University Nov., 2009
Java Java java Java Java Java ……
Java Java 1
Java Java 1 Java.java Java
Java Java 1.1 Java Java HelloWorld HelloWorld.java Java main // The First Java Program public class HelloWorld { public static void main(String[] args){ System.out.println("Hello World "); } } HelloWorld main
Java Java 1.1 Java Java HelloWorld.java javac Yes javac HelloWorld.java HelloWorld.class java HelloWorld No Java.class Java
Java Java 1.2 Java Java Java abstractdefaultifprivatethrow booleandoimplementsprotectedthrows breakdoubleimportpublictransient byteelseinstanceofreturntry caseextendsintshortvoid catchfinalinterfacestaticvolatile charfinallylongsuperwhile classfloatnativeswitch constfornewsynchronized continuegotopackagethis
Java Java 1.3 // package import class public | protected | private protected | private public | protected | private protected | private static public | protected | private protected | private static final
Java Java 2 Java Java Java
Java Java 2.1 / bit,binary digit ASCII ASCII Unicode
Java Java 2.2 Java final final double PI = ; // PI int x, y; // x, y double w = ;// w boolean truth = true;// truth Constant const = new Constant();// const
Java Java 2.3 Java primitive type object type Java ADT Java API Java Java primitive float char object int long byte short double boolean
Java Java 2.3 Java Java String int length() String substring(int beginIndex, int endIndex) beginIndex endIndex int indexOf(int ch) 0 ch -1 int indexOf(String str) 0 str -1 boolean equals(Object anObject) true false equals 2 2 Srting name1 = new String(" ");// //name1 Srting name2 = " ";//name2 Srting name3 = " ";// name3 name1 = " ";//name1
Java Java 2.3 Java char byteshortintlong floatdouble ( ) double pi = ; int p = (int)pi; //p=3
Java Java 3 Java x{ } PI{ } System.out.println(" "+n);{ } x * y{ } x = 1.5{ } love2.equals(love1) { } int p = (int)PI;{ }
Java Java 3 = += -= *= /= %= JavaC/C++DelphiVisual Basic ++ Inc() -- Dec() JavaC/C++DelphiVisual Basic **** //// //div/ %Mod JavaC/C++DelphiVisual Basic == = = is != <> >>>> <<<< <= >= JavaC/C++DelphiVisual Basic && And || Or !!NotNo JavaC/C++DelphiVisual Basic &&and ~~not or ^^xor << Shl >> Shr
Java Java 3 Java [ ]. () ~ new () * / % + - > > == != & ^ | && || ?: A>B?X:Y = += -= *= /= %=
Java Java 4 Java ; int classNumber; boolean isFinished; String className = 2009 ; int a = 5; = ; classNumber = 100; isFinished = true; multi = classNumber * 100 / a ;
Java Java 4 Java ( ). ; System.out.println("Hello World ");
Java Java 5 Java if switch Java while do-while for
Java Java 5 switch switch switch ( ) { case 1: 1;// 1 break; case 2: 2;// 2 break;... case n: n;// n break; default: ; } if ( ) { // ;... }// {} else{ // 1;... }// {} if-else if
Java Java 5 while do-while for while ( ) { ;... } // {} do { ;... } while ( ); for ( ; ; ) { ;... } // {}
Java Java 5 break while do-while for break continue continue
Java Java 2 11 Calc.java public class Calc{ public static void main(String[] args) { int x; for (x=0;x<100;x++) { if ((x%3==2) && (x%5==3) && (x%7==2)) { System.out.println(" "+x); } }//end of main }//end of Calc
Java Java Hello World 10 Hello World 100/1000/10000 ? 5
Java Java …… 2009