black

SCJP程序员认证考试

登录

单项选择题

1. class A { 
2. public int getNumber(int a) { 
3.     return a + 1; 
4. } 
5. } 
6.   
7. class B extends A { 
8. public int getNumber (int a) { 
9. return a + 2 
10. } 
11.   
12. public static void main (String args[])  { 
13. A a = new B(); 
14. System.out.printIn(a.getNumber(0)); 
15.    }
16. }    
What is the result?()  

A. Compilation succeeds and 1 is printed.
B. Compilation succeeds and 2 is printed.
C. An error at line 8 causes compilation to fail.
D. An error at line 13 causes compilation to fail.
E. An error at line 14 causes compilation to fail.

相关考题

填空题 5. String foo = “base”;  6. foo.substring(0,3);  7. foo.concat(“ket”)  8.     Type the value of foo at line 8.()

单项选择题 public class X implements Runnable (  private int x;  private int y;  public static void main(String [] args) (  X that = new X();  (new Thread(that)) . start( );  (new Thread(that)) . start( );  )  public synchronized void run( ) (  for (;;) (   x++;  y++;  System.out.printIn(“x = “ +  x  + “, y = “ + y);  )  )  )   What is the result?()

单项选择题 public class SyncTest (  private int x;  private int y;  private synchronized void setX (int i) (x=1;)  private synchronized void setY (int i) (y=1;)  public void setXY(int 1)(set X(i); setY(i);)  public synchronized Boolean check() (return x !=y;)  )  Under which conditions will check () return true when called from a different class?

All Rights Reserved 版权所有©建筑考试题库(jzkao.com)

备案号:湘ICP备2020024380号-3