JAVA期末考试模拟试题.docVIP

  • 12
  • 0
  • 约2.26万字
  • 约 12页
  • 2017-08-26 发布于河南
  • 举报
一、选择题(每小题1分,共 10 分,注:选择答案可能不止一个正确) 1、编译Java Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为( )。A. .java B. .class C. .html D. .exe 2、设 x = 1 , y = 2 , z = 3,则表达式 y+=z--/++x 的值是( )。 A. 3 B. 3. 5 C. 4 D. 5 3、在Java Applet程序用户自定义的Applet子类中,一般需要重载父类的( )方法来完成一些画图操作。 A. start( ) B. stop( ) C. init( ) D. paint( ) 4、不允许作为类及类成员的访问控制符的是( )。 A. public B. private C. static D. protected 5、为AB类的一个无形式参数无返回值的方法method书写方法头,使得使用类名AB作为前缀就可以调用它,该方法头的形式为( )。 A. static void method( ) B. public void method( ) C. final void method( ) D. abstract void method( ) 6、下面哪些是java语言中的关键字??sizeof?B.?abstract? C.?NULL?D.?Native? 7、下面语句哪个是正确的?? ?A. char c =abc; B.? long?l=oxfff;? C. ?float?f=0.23;? D.? double d =0.7E-3;? 8、以下程序测试String?类的各种构造方法,试选出其运行效果。?   class?STR{public static void main(String args[]){ String s1=new String(); String s2=new String(String 2); char chars[]={a, ,s,t,r,i,n,g}; String s3=new String(chars); String s4=new String(chars,2,5); byte[] bytes={72,101,108,108,79,33}; //A、a和“!”号的ASCII分别为65、97和33 StringBuffer sb=new StringBuffer(s3); sb.append(“!”); String s5=new String(sb); String s6 = new String(bytes); System.out.println(The String No.1 is +s1); System.out.println(The String No.2 is +s2); System.out.println(The String No.3 is +s3); System.out.println(The String No.4 is +s4); System.out.println(The String No.5 is +s5); System.out.println(The String No.6 is +s6);}} ? A?. The?String?No.1?is? B. The String No.1 is    The?String?No.2?is?String?? The String No.2 is String 2    The?String?No.3?is?a?string ? The String No.3 is a string    The?String?No.4?is?string? The String No.4 is strin    The?String?No.5?is?a?string? The String No.5 is a string! The String No.6 is HELLO!

文档评论(0)

1亿VIP精品文档

相关文档