black

SCJP程序员认证考试

登录

单项选择题

10. public class SuperCaic { 
11. protected static int multiply(int a, int b) { return a * b; } 
12. } 
and: 
20. public class SubCalc extends SuperCalc { 
21. public static int multiply(int a, int b) { 
22. int c = super.multiply(a, b); 
23. return c; 
24. } 
25. } 
and: 
30. SubCalc sc = new SubCalc(); 
31. System.out.println(sc.multiply(3,4)); 
32. System.out.println(SubCalc.multiply(2,2)); 
What is the result?()

A. 12 4
B. The code runs with no output.
C. An exception is thrown at runtime.
D. Compilation fails because of an error in line 21.
E. Compilation fails because of an error in line 22.
F. Compilation fails because of an error in line 31.

相关考题

单项选择题 public class Foo {  public int a;  public Foo() { a = 3; }  public void addFive() { a += 5; }  }  and:  public class Bar extends Foo { public int a;  public Bar() { a = 8; }  public void addFive() { this.a +=5; }  }  invoked with:  Foo foo = new Bar();  foo.addFive();  System.out.println(”Value: “+ foo.a);  What is the result?()

多项选择题 1. public class Blip {  2. protected int blipvert(int x) { return 0; }  3. }  4. class Vert extends Blip {  5. // insert code here  6. }  Which five methods, inserted independently at line 5, will compile?()

单项选择题 1. public class Employee {  2. String name;  3. double baseSalary;  4. Employee(String name, double baseSalary) {  5. this.name = name;  6. this.baseSalary = baseSalary;  7. }  8. }  And:  1. public class Salesperson extends Employee { 2. double commission;  3. public Salesperson(String name, double baseSalary,  4. double commission) {  5. // insert code here  6. } 7. }  Which code, inserted at line 7, completes the Salesperson constructor?()

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

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064