大一java期末考试模拟题,java期末考试模拟试题-final

41528d3028836879cd698677c3999917.gifjava期末考试模拟试题-final

《JAVA 语言程序设计》期末考试模拟试题 1 一、选择题( 每小题 1 分,共 10 分,注:选择答案可能不止一个正确) 1、编译 Java Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展 名为( ) 。A. .java B. .classC. .html D. . 2、设 x = 1 , y = 2 , z = 3,则表达式 y+=z --/ ++x 的值是( )。A. 3 B. 3. 5C. 4 D. 5 3、在 Java Applet 程序用户自定义的 Applet 子类中,一般需要重载父类的( )方法来 完成一些画图操作。A. start( ) B. stop( )C. init( ) D. paint( ) 4、不允许作为类及类成员的访问控制符的是( ) 。A. public B. privateC. static D. protected 5、为 AB 类的一个无形式参数无返回值的方法 书写方法头,使得使用类名 AB 作 为前缀就可以调用它,该方法头的形式为( ) 。A. static void ( ) B. public void ( ) C. final void ( ) D. abstract void ( ) 6、下面哪些是 java 语言中的关键字? A. 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 isThe String No.2 is String The String No.2 is String 2The String No.3 is a string The String No.3 is a stringThe String No.4 is string The String No.4 is strinThe String No.5 is a string The String No.5 is a string! The String No.6 is HELLO! The String No.6 is Hello!C. The String No.1 is The String No.2 is String 2 The String No.3 is a string The String No.4 is strin The String No.5 is a string The String No.6 is hello!D 以上都不对 9、下面语句段的输出结果是( ) int i = 9; switch (i) { default: System.out.println(“default“); case 0: System.out.println(“zero“); break; case 1: System.out.println(“one“); case 2: System.out.println(“two“); } A. default B. default, zero C. error default clause not defined D. no output displayed 10、下面哪些语句能够正确地生成 5 个空字符串? A . String a[]=new String[5]; B. String a[]={““,““,““,““,““}; for(int i=0;i1) break;System.out.println(j+“and“+i);}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值