1、javaEclipseEclipsehttp:/www.eclipse.orgDownloadsEclipse3.33.33.23.2Eclipse SDKeclipse-SDK-3.2-win32.zipD:eclipseEclipseJDKJAVA_HOMECLASSPATHPATHD:eclipseeclipse.exeEclipse=JRE:1. Window-Preferences,Java-Installed JREs,jre1.5.0_07,Edit.2. Browse,JDK,OK.EclipseJDK.=EclipseHellWorld1File-New-Project2Ja
2、va Project34JavaJRE(); .5Finish;6. src,New-Package,;7JavaC;8HelloWorld9public static void main(String args) Eclipsemain;10Finish;11JavamainSystem.out.println(Hello World)12Ctrl-s HelloWorld.java13Run AsJava Application14Hello World=eclipse1. eclipse?:,(/opt/eclipse/eclipse).2. ?:Window-Preferences,G
3、eneral-Editors-Text Editors,show line numbers.3. java?:Window-Preferences,General-Appearance-Colors and Fonts-Java-Java Editor Text FontChange.4. ?: Window-Preferences,Java-Code style-Code Templates,CommentsCode,Edit,.5. ?:,Refresh,.6. Eclipse:Ctrl+Enter:Alt+Shift+X+J:Ctrl+F11:Shift+Ctrl+F:Shif
4、t+Ctrl+X:Shift+Ctrl+Y:Ctrl+1:Ctrl+M:Alt+Shift+S:SourceAlt+/:Ctrl+/:/Ctrl+D:Ctrl+:Ctrl+Shift+S:Java 20074231JavaGolsling1995523 Java199812 1.2 Java2 J2SE J2EE J2ME200412 1.5(5.0) Java JavaSE JavaEE JavaME2Java SE - JavaJava EE - Java ME - 31 - 2 - C+javac+55%3 - 4 - 4javajava.classJVM .java - .class
5、- C+205javamainmainpublic class Hello /public static void main(String args) / public static System.out.println(Hello world); / javac xxxx.java .class java xxxx - 6JAVA_HOME = /opt/jdk1.5.06 JDK - JDK = JRE JVM()+ +PATH = $Path:$Java_Home/bin:.ClassPath = . 7 - . java xxx.xxx.ClassA - javac -d . xxxx
6、.java - .classpackage xxx.xxximport xxx.xxx.xxx.ClassA; - ClassAimport p1.p2.p3.p4.p5.*; - p5javajava.lang8java /. /* .*/* .()*/,javadochtmlhtmljavadoc -d xxx.java author version param ,return throws10 - Javajavagotoconstjavajavasizeofjavabooleantruefalseenum assert 11123* * * *Java 20074241Java1 -
7、8a) byte 1 8 -128127short 216 -215215-1 -32768 32767int 432 -231231-1 -2147483648 2147483647 long 864 -263263-1 long a = 40000l; /llongb) float 432 float a = 1.3f;double 864 double a = 1.3;doublelongdouble float a = 1.3; /error float a = (float)1.3;float a = 1.3f;c) char 216d) boolean false/true /Ja
8、vafalse0a babdouble , doubleabfloat , floatablong , longintchar16, aString String+charASCIIu0000()charunicodechar c1 = a;char c2 = 97;char c3 =u0061; /20double022javajavac+* System.out.println(3/2) 1 *byte a = 1;a=a+2; /a += 2 ; /,a+ ; /1) = ; 22) = =n2n3) & & int a = 4;if(a3&(b=a)=0) bif(a3&(b=a)=0
9、) b4) | | 5) instanceof6) java% 5%2=131if()if().elseif().else if().elseelseif()2switch(s)case a:.case 1:breakdefault:switch()byte short char intswitch()casebreak4for(int i=0;ipos;i-)ai=ai-1;apos=value;index+;static void delete(int pos)index-;for(int i=pos;iindex;i+)ai=ai+1;static void expand()int b=
10、new inta.length*2;System.arraycopy(a,0,b,0,a.length);a=b;static void print()for(int i=0;i - 2(a)0 |(b) |(c) |(d) |(e) |V6javaoverload* *public void m(byte a,short b)System.out.println(m(byte,short);public void m(short a,byte b)System.out.println(m(short,byte);2bytem()71238Java123Student s /Students = new Student(); /Student,Students.age sage9static void method3(Student s)s=new Student(); /s.age=20; /Student stu=new Student();System.out.println(stu.age); / Studentagemethod3(stu); /method3s