this()和super()只能位于构造函数中的第一句
A、对
B、错
相关问题推荐
-
已知表达式intm[]={0,1,2,3,4,5,6};下面哪个表达式的值与数组下标量最大值相等()。
A、m. length()
B、m. length-1
C、m. length()+1
D、m. length+1
-
两个线程并发执行以下代码,假设a是全局变量,那么以下输出()哪个是可能的。
A、32
B、23
C、33
D、22
-
现有: class Waiting implements Runnable { boolean flag=false; public synchronized void run() { if (flag) { flag=false; System.out.print ("1"); try { this.wait(); ) catch (Exception e) { } System.out.print ("2"); } else { flag=true; System.out.print ("3"); try{Thread.sleep (2000); } catch(Exception e) {} System.out.print ("4"); notify(); } } public static void main (String [] args) { Waiting w=new Waiting(); new Thread (w) .start(); new Thread (w) .start(); } } 以下哪两项是正确的?()
A代码输出l 3 4
B代码输出3 4 1
C代码输出l 2 3 4
D代码输出1 3 4 2
E代码运行完毕
F代码不会完成
-
现有: 1. class Alpha { void m1() {} } 2. class Beta extends Alpha { void m2() { } } 3. class Gamma extends Beta { } 4. 5. class GreekTest { 6. public static void main(String [] args) { 7. Alpha [] a = {new Alpha(), new Beta(), new Gamma() }; 8. for(Alpha a2 : a) { 9. a2.m1(); 10. if (a2 instanceof Beta || a2 instanceof Gamma) 11. //insert code here 12. } 13. } 14. } 哪一行代码插入到第11行,将编译但是会在运行时产生异常?()
A、 a2.m2();
B、 ((Beta)a2).m2();
C、 ((Alpha)a2).m2();
D、 ((Gamma)a2).m2();
-
组件的getBounds()方法返回值的类型是哪项?()
A、 Dimension
B、 Rectangle
C、 Point
D、 int[]