【单选题】【消耗次数:1】
下列程序的运行结果是( ) 。 public class X5_1_2 extends x{ int ab() { static int aa=10; aa++; System.out.println(aa); } public static void main(String[] args) { X5_1_2 x=new X5_1_2(); x.ab(); } }
10
11
编译错误
运行成功,但不输出
参考答案:
复制
纠错
相关题目
【单选题】 下面代码运行后的输出结果为( ) 。 public class X6_1_5 { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(b@@equals(aa)); } } class AB{ int x = 100; }
①  true
②  false
③  编译错误
④  100
【单选题】 关于以下application的说明,正确的是( ) 1. class StaticStuff 2. { 3. static int x=10; 4. static { x+=5;} 5. public static void main(String args[ ]) 6. { 7. System.out.println(“x=” + x); 8. } 9. static { x/=3;} 10. }
①  4行与9行不能通过编译,因为缺少方法名和返回类型
②  9行不能通过编译,因为只能有一个静态初始化器
③  编译通过,执行结果为:x=5
④  编译通过,执行结果为:x=3
【单选题】 编译运行以下程序后,关于输出结果的说明正确的是 ( ) public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 9.9:9)); } }
①  输出结果为:value is 99.9
②  输出结果为:value is 9
③  输出结果为:value is 9.0
④  编译错误
【单选题】 已知有下面类的说明: public class X5_1_1 extends x{ private float f =10.6f; int i=16; static int si=10; public static void main(String[] args) { X5_1_1 x=new } } X5_1_1(); 在 main()方法中,下面哪条语句的用法是正确的?( )
①  x.f
②  this.si
③  X5_1_1.i
④  X5_1_1.f
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_5 { public static void main(String[] args) { int[] z = { 1,2,3,4 } ; int p = z[4]; int x = 0; int y = 5/x; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 下列程序执行的结果是( ) 。 public class X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println(Finally); } } }
①  程序正常运行,但不输出任何结果
②  程序正常运行,并输出 Finally
③  编译通过,但运行时出现异常
④  因为没有 catch 子句,因此不能通过编译
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_4 { public static void main(String[] args) { int x = 0; int y = 5/x; int[] z = { 1,2,3,4 } ; int p = z[4]; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 以下程序的运行结果是:( ) public class Increment{ public static void main(String args[]){ int c; c = 2; System.out.println(@@; System.out.println(c++); System.out.println(@@; } }
①  2 2 2
②  2 3 3
③  2 2 3
④  3 4 4
【单选题】 关于以下程序代码的说明正确的是( ) 1.class HasStatic{ 2. private static int x=100; 3. public static void main(String args[ ]){ 4. HasStatic hs1=new HasStatic( ); 5. hs1.x++; 6. HasStatic hs2=new HasStatic( ); 7. hs2.x++; 8. hs1=new HasStatic( ); 9. hs1.x++; 10. HasStati@@x- -; 11. System.out.println(“x=”+x); 12. } 13. }
①  5行不能通过编译,因为引用了私有静态变量
②  10行不能通过编译,因为x是私有静态变量
③  程序通过编译,输出结果为:x=103
④  程序通过编译,输出结果为:x=102
【单选题】 编译下面源程序会得到哪些文件( )? class A1{ } class A2{ } public class B{ public static void main(String[] args) { } }
①  只有B.class 文件
②  只有 A1.class 和 A2.class 文件
③  编译不成功
④  A1.class、A2.class 和B.class 文件
随机题目
【单选题】 由生产的技术水平所决定的生产资料和劳动力之间的比例,叫作资本的
①  结构构成
②  价值构成
③  技术构成
④  有机构成
【单选题】 商品交换中价值与价格的关系表现为
①  价格总是高于价值
②  价格总是低于价值
③  价格总是等于价值
④  价格总是围绕价值上下波动
【单选题】 资本是
①  购买生产资料的资本
②  购买商品的货币
③  带来剩余价值的价值
④  购买劳动力的货币
【单选题】 生产商品的劳动二重性是指
①  简单劳动和复杂劳动
②  私人劳动和社会劳动
③  具体劳动和抽象劳动
④  生产劳动和非生产劳动
【单选题】 资本主义经济危机爆发的根源是
①  私人劳动和社会劳动的矛盾
②  无产阶级和资产阶级的矛盾
③  资本主义的基本矛盾
④  使用价值和价值的矛盾
【单选题】 在物物交换中,商品价值表现为
①  价格
②  使用价值
③  货币
④  交换价值
【单选题】 生产商品的劳动分具体劳动和抽象劳动,其中具体劳动的作用是
①  创造新价值
②  创造剩余价值
③  创造必要价值
④  创造使用价值
【单选题】 资本主义经济危机的实质是
①  生产过剩的危机
②  生产不足的危机
③  生产相对过剩的危机
④  生产绝对过剩的危机
【单选题】 在下列经济行为中,属于货币执行流通手段职能的是
①  顾客用10元钱可购买5斤苹果
②  顾客购买5斤苹果,一周后付款10元
③  顾客用10元钱购买了5斤苹果
④  顾客向水果店以每斤2元的价格预定5斤苹果
【单选题】 在揭示资本主义工资问题上,首先要区分
①  必要劳动和剩余劳动
②  劳动和劳动力
③  具体劳动和抽象劳动
④  私人劳动和社会劳动