black

SCJP程序员认证考试

登录

单项选择题

11. class Person { 
12. String name = “No name‟; 
13. public Person(String nm) { name = nm; } 
14. } 
15. 
16. class Employee extends Person { 
17. String emplD = “0000”; 
18. public Employee(String id) { empID = id; } 
19. } 
20. 
21. public class EmployeeTest { 
22. public static void main(String[] args) { 
23. Employee e = new Employee(”4321”); 
24. System.out.println(e.empID); 
25. } 
26. } 
What is the result?() 

A. 4321
B. 0000
C. An exception is thrown at runtime.
D. Compilation fails because of an error in line 18.

相关考题

单项选择题 class One {  public One() { System.out.print(1); }  }  class Two extends One {  public Two() { System.out.print(2); }  }  class Three extends Two {  public Three() { System.out.print(3); }  }  public class Numbers{  public static void main( String[] argv) { new Three(); }  }  What is the result when this code is executed?()

单项选择题 10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

单项选择题 10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?()

All Rights Reserved 版权所有©考试题库网(kstiku.com)

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064