易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

1. class SuperClass {  2. public a geta() {  3. return new a();  4. }  5. }  6. class SubClass extends SuperClass {  7. public b geta() {  8. return new b();  9. }  10. }  Which is true?() 

A、 Compilation will succeed if a extends b.

B、 Compilation will succeed if b extends a.

C、 Compilation will always fail because of an error in line 7.

D、 Compilation will always fail because of an error in line 8.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • 35. String #name = “Jane Doe”;  36. int$age=24;  37. Double_height = 123.5;  38. double~temp = 37.5;  Which two are true?()

    A

     Line 35 will not compile.

    B

     Line 36 will not compile.

    C

     Line 37 will not compile.

    D

     Line 38 will not compile.

  • 1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  

    A、  Public float getNum()   {return 4.0f; }

    B、  Public void getNum ()  { }

    C、  Public void getNum (double d)   { }

    D、  Public double getNum (float d) {retrun 4.0f; }

  • 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?()  

    A、 An error at line 11 causes compilation to fail.

    B、 Errors at lines 7 and 8 cause compilation to fail.

    C、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”)

    D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”)

    E、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=2s, y=2”)

  • boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?()  

    A、 a

    B、 b

    C、 c

    D、 d

    E、 Compilation fails.

  • public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?() 

    A、Compilation fails.

    B、 “odd” will always be output.

    C、 “even” will always be output.

    D、 “odd” will be output for odd values of x, and “even” for even values.

    E、 “even” will be output for add values of x, and “odd” for even values.

联系客服 会员中心
TOP