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

Which statement is true?()

A、 Compilation succeeds.

B、 class A does not compile.

C、 The method declared on line 9 cannot be modified to throw TestException.

D、 TestA compiles if line 10 is enclosed in try/catch block that catches TestException.

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

相关问题推荐

  • 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.

  • 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.

  • Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }  

    A

    c = b;

    B

    c = this.a;

    C

    c = this.b;

    D

    c = Q4a39.this.a;

    E

    c = c;

  • What is the result?()

    A、 Compilation fails.

    B、 An exception is thrown at runtime.

    C、 The code executes normally and prints "sleep".

    D、 The code executes normally, but nothing is printed.

  • 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”)

联系客服 会员中心
TOP