Java习题集+答案

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

      Java       2008Page1of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware     1.1.A  Page2of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware          B.class          C.html       D.exe2.Java       B.Java           D.Java     B.    C.    D.        B.java.lang      C.java.new D. 9.Javac12.       2.C 3.B 4.D  2. 3. 4. 5. 6. 7. 8. 9. 10.2. “Writeonce,runeverywhere”Page3of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware    1.Java()A.single       B.double            C.byte         D.char2.inta=10,b=4,c=20,d=6;System.out.println(a++*b+c*--d);()A.144         B.28            C.140         D.3.inta=-67,b=116,c=78;intd=ab&c;System.out.println(d);       ()A.70           B.67            C.78           D.564.publicclasstest{staticinta[]=newa[10];publicstaticvoidmain(Stringargs[]){System.out.println(arr[10]);}}()A.                               B.C.                                               D.5.main()A.publicmain(Stringargs[])B.publicstaticvoidmain(Stringargs[])C.privatestaticvoidmain(Stringargs[])D.voidmain()6.System()A.javA.util          B.java.io                    C.java.awt                 D.java.lang7.:()1)publicvoidmodify(){2)intI,j,k;3)I=100;   4)while(I0){5)j=I*2;6)System.out.println(Thevalueofjis+j);7)k=k+1;8)I--;9)}10)}A.line1       B.line6        C.line7D.line81.JBuilder9myjava.jpx,myfirstapp.javamyjava.jpx2.DEmyjavaJavamyfirstapp.javamyjavaJavaJavaApplicationJavaApplet212. 1.B 2.C 3.A 4.A 5.B 6.D 7.A1.JavaJavaforwhilebooleanJava2.JavaidentifierPage4of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware Page5of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware 1.A.Java_proc       B.          C._bit                 D.5jobE.t.45                 F.%tools             G.100.8              H.name2.MathA.abs()                                  B.exp()C.log()                                  D.sqrt()E.sin(),cos(),tan()                  F.max()min()G.pow()3.forwhile()A.whileforB.whileforC.D.4.Java()A.double B.long   C.int   D.byte5.Java()A.  B.  C.  D.6.JAVA“”“”()A.“”B.“”C.“”D.1.for2.do…while3.Java“4.Javaforwhiledo…while5.Javaforwhiledo…while6.breakswitch1Java2.Java3.Javamethod 1.ABCH 2.ABCDEFG 3.D 4.D 5.B 6.B 7.D1.2. 3. 4. 5. 6. 7.1.:integer()floating()Boolean()CharacterorString()2.JavaJava43method Page6of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware 1.for2.dowhile3.breakbreak4.JavaJavaAPIJava5.Javajava.Langimport6.Javaimportjava.io.*;*7.Java.awtJavaGUI38.VectortheVecto=newVector(100,100);theVector100101.102.50~1001.2.3.4. 1.2. 3. 4. 5. 6. 7.8.1.l       charc=(char)(Math.random()*26+'a')l       aeiouyw19l       forl       switchcase publicclassVowelsConsonants{ publicstaticvoidmain(String[]args){  for(inti=0;i10;i++){   charc=(char)(Math.random()*26+'a');//   System.out.print(c+is);   //   switch(c)   {case'a':   case'e':   case'i':   case'o':   case'u':     System.out.println(avowel.);     break;    case'y':    case'w':     System.out.println(Sometimesavowel.);     break;    default:System.out.println(aconsonant.);   }  } }}2.1 packagech02; /** *pTitle: *pDescription:Page7of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware *pCompany: *pAddress: *pEmail:qinxueli@zj.com/p *pPostcode:310018/p *@version1.0 */ publicclassFindPrime{  publicstaticvoidmain(String[]args){ next:for(inti=50;i=100;i++){    for(intj=2;ji;j++){     if(i%j==0)//       continuenext;     }     System.out.print(i+);//   } }} 1.2.Java3staticstatic4.publicprotectedfinalprivatestaticPage8of282010-1-25=20091103123532244015GeneratedbyFoxitPDFCreator©FoxitSoftware   1._______2.Java_______3._______ 4._______5._______1.( )A..B.C.D.2.MyClass”( )A.privateclassMyClassextendsObjectB.classMyClassextendsObjectC.publicclassMyClass                              D.privateclassMyClassextendsObject 3.Java( ) A.public                    B.private            C.default            D.final4.( )A.       B.           C.  D.5.( )A.public              B.private             C.protected                D.transient1.( )publicclassT1{             publicstaticvoidmain(String[]args){        T1a=newT1();        a.method(8);        a.method(1.2f);     

1 / 28
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功