您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 招聘面试 > java_Java编程经典
JavaJavaJava——2010JavaJava1Java2Java34JavaApplet5Java6Java789Java10Java(11Java)(12Java)13ServletXML14JavaJava1Java1.1Java1.2Java1.3Java1.4JDK1.5Java1.6Java1.1JavaJavaJavaJava1.2Java1.JavaJavaJavaJavaJavaJavaJavaJava2.JavaJava3.JavaJavaJavaJavaJavaJava4.JavaJava5.JavaJava1.3Java1.JavaGUIJavaJava2.ServletsJava3.AppletsAppletsHTMLJavaHTML/APPLETAppletsJava1.4JDKJavaDevelopKitJDKSunSun:\j2sdk1.4.0_01Java1.5JavaJDK“”“”“”“”“”1.1Java1.1“”Java“”1.2includelibpathJDKJava1.2“”Javainclude“”“”1.3“;D:\j2sdk1.4.0_01\include”“;”JDKinclude1.3includeJava1.3includeJavalib“”“”1.4“;D:\j2sdk1.4.0_01\lib”“;”JDKlib1.4libJava1.4libJavapath“”“”1.5“;D:\j2sdk1.4.0_01\bin”“;”JDKbin1.5pathJava1.5pathJava1.61.1HelloWorld.java“HelloWorld”//HelloWorld.javapublicclassHelloWorld{publicstaticvoidmain(Stringargs[]){System.out.println(HelloWorld);}}JavaEditPlusHelloWorld.javaEditPlus“”1.6“E:\_Work\Java\sample”“javacHelloWorld.java”1.6HelloWorld.class.class“javaHelloWorld”“HelloWorld”1.7Java1.6HelloWorldJava1.7HelloWorldJavaJavacJavaJDKJDKbinjavac.exe.classJava.exeJavaJava1.2“HelloWorld”1.8//HelloApplet.javaimportjava.awt.Graphics;importjava.applet.Applet;publicclassHelloAppletextendsApplet{publicvoidpaint(Graphicsg){g.drawString(HelloWorld!,50,25);}}JavaHTML!-HelloApplet.html--JavaHelloAppletwillappearbelowinaJavaenabledbrowser.Java1.8Applet“HelloWorld”Java1.Java2.Java3.Java4.“Java”5.Applet“Java”Java2Java2.1Java2.22.32.42.5Java2.1Java2.1.1Java1.JDKJava2.JavaJavamainAppletAppletJava“{”“}”Java2.1AppletHTMLappletviewer“XXXJava”2.1//WelcomeApplet.javaimportjava.applet.*;??importjava.awt.*;?importjava.awt.event.*;??publicclassWelcomeAppletextendsAppletimplementsActionListener{JavaLabellblName;??TextFieldtxtName;?TextFieldtxtDisp;??publicvoidinit()??{?lblName=newLabel();??txtName=newTextField(8);?txtDisp=newTextField(20);??initadd(lblName);??add(txtName);?add(txtDisp);??txtName.addActionListener(this);?}?JavapublicvoidactionPerformed(ActionEvente)??actionPerformed{txtDisp.setText(txtName.getText()+Java);??}?Javapublicstaticvoidmain(Stringargs[])??{?Framef=newFrame();?f.addWindowListener(newWindowAdapter()){??publicvoidwindowClosing(WindowEventevt)??{?System.exit(0);??}??}?main?;?WelcomeAppleta=newWelcomeApplet();??a.init();?f.add(Center,a);??f.setSize(400,300);?f.show();??a.start();??}?Java2.1Java2.1.2Java(1)“;”(2){}(3)JavaJava1.1LabellblName;TextFieldtxtName;TextFieldtxtDisp;{lblName=newLabel();txtName=newTextField(8);txtDisp=newTextField(20);add(lblName);add(txtName);add(txtDisp);txtName.addActionListener(this);}Java2.1.3///**/Java//WelcomeApplet.java/*WelcomeApplet.java*//*WelcomeApplet.java*/Java2.1.4Java(1)(_)($)(2)(3)Java(4)(5)JavaJavapublicdouble(\)2.1Java2.1\b\t\n\f\r\'\\\TabJava2.22.2.1Java(2.2)(byteshortintlong)(char)(doublefloat)(boolean)Java2.2Javabyteshortintlongcharfloatdoubleboolean816326416326480000\u00000.0F0.0DFalse77-22-11515-22-13131-22-16363-22-1221\u0000\uFFFF——TrueFalseJava1.(1)——2——2077——00xBAAC——0x(2)int(3)“L”“l”long(4)JavaJava2.(1)16bitUnicode(2)('')(3)'a'——'\t'--'\u????'--Unicode????Java3.doubleFf(float)Dd(double)Java4.booleantruefalsebooleanflag=true;flagbooleantrueJava2.2.2π=3.1415……Javapis1i1l1ch1f1d1b1changemains2i2l2ch2f2d2b2mainmain2.22.2//SetVariable.javapublicclassSetVariable{//Javastaticdoublepi=3.141592654//staticshorts1;staticinti1;staticlongl1;staticcharch1;staticfloatf1;staticdoubled1;staticbooleanb1;publicstaticvoidmain(Stringargs[]){Java//shorts2=35;inti2=-32;longl2=34555L;charch2='A';floatf2=897.89F;doubled2=34.345;booleanb2=false;//System.out.println(pi=+pi);//JavaSystem.out.println(************);System.out.println(s2=+s2);System.out.println(i2=+i2);System.out.println(l2=+l2);System.out.println(ch2=+ch2);System.out.println(f2=+f2);System.out.println(d2=+d2);System.out.println(b2=+b2);//Javachange();//System.out.println(************);System.out.println(s1=+s1);System.out.println(i1=+i1);System.out.println(l1=+l1);System.out.println(ch1=+ch1);System.out.println(f1=+f1);System.out.println(d1=+d1);System.out.println(b1=+b1);}Java//publicstaticvoidchange(){s1=125;i1=88;l1=987654321L;ch1='B';f1=3.2590F;d1=-1.04E-5;b1=true;}}Java2.2Java2.3JavaJava2.3.1Java+*/%++-()Java2.32.3//NumberOper.javapublicclassNumberOper{publicstaticvoidmain(Stringargs[]){//inta=30;intb=20;//intr1,r2,r3,r4,r5,r6,r7,r8,r9;//r1=a+b;Javar2=a-b;r3=a*b;r4=a/b;r5=a%b;r6=a++;r7=b--;r8=++a;r9=--b;//System.out.println(a=+a+b=+b);//a,bSystem.out.println(a+b=+r1);System.out.println(a-b=+r2);JavaSystem.out.println(a*b=+r3);System.out.println(a/b=+r4);System.out.println(a%b=+r5);System.out.println(a++=+r6);System.out.println(b--=+r7);System.out.println(++a=+r8);System.out.println(--b=+r9);}}Java2.3Java2.3.2“”“”Java==!===Java2.42.4//TestRelation.javapublicclassTestRelation{publicstaticvoidmain(Stringargs[]){//inta=30;intb=20;//booleanr1,r2,r3,r4,r5,r6;//Javar1=a==b;r2=a!=b;r3=ab;r4=ab;r5=a=b;r6=a=b;//System.out.println(a=+a+b=+b);System.out.println(a==b=+r1);
本文标题:java_Java编程经典
链接地址:https://www.777doc.com/doc-6182570 .html