当前位置:SCJP程序员认证考试题库

问题:

[单选]

class A { 
public A() { 
System.out.println(“hello from a”); 
} 
} 
class B extends A { 
public B () { 
System.out.println(“hello from b”); 
super(); 
} 
} 
public class Test { 
public static void main(String args[]) { 
A a = new B(); 
} 
}  
What is the result when main is executed?()  

A .  Compilation fails.
B .  hello from a
C .  hello from b
D .  hello from b hello from a
E .  hello from a hello from&e

创作方法与文艺思潮 柯尔伯格采用了(),让儿童在两难推理中作出选择并说明理由。 处理‘呆滞品’的途径有哪些? 离散型随机变量 在我国,企业年金缴费由企业来负担。

class A { 
public A() { 
System.out.println(“hello from a”); 
} 
} 
class B extends A { 
public B () { 
System.out.println(“hello from b”); 
super(); 
} 
} 
public class Test { 
public static void main(String args[]) { 
A a = new B(); 
} 
}  
What is the result when main is executed?()  

参考答案:

  参考解析

Call to super must be first statement in constructor. 

在线 客服