单选题Given: What is the result?()ACompilation fails.BAn exception is thrown at runtime.CThe code executes normally and prints "sleep".DThe code executes normally, but nothing is printed.

题目
单选题
Given: 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.


相似考题
参考答案和解析
正确答案: D
解析: 暂无解析
更多“单选题Given: 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.”相关问题
  • 第1题:

    public class foo {   public static void main (stringargs)   try {return;}   finally {system.out.printIn(“Finally”);}   }     What is the result?()  

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Finally”
    • C、 The code compiles, but an exception is thrown at runtime.
    • D、 The code will not compile because the catch block is missing.

    正确答案:B

  • 第2题:

    public class TestOne implements Runnable {  public static void main (String[] args) throws Exception {  Thread t = new Thread(new TestOne());  t.start();  System.out.print(”Started”);  t.join();  System.out.print(”Complete”);  }  public void run() {  for (int i= 0; i< 4; i++) {   System.out.print(i);  }  }  }  What can be a result?()

    • A、 Compilation fails.
    • B、 An exception is thrown at runtime.
    • C、 The code executes and prints “StartedComplete”.
    • D、 The code executes and prints “StartedComplete0123”.
    • E、 The code executes and prints “Started0l23Complete”.

    正确答案:E

  • 第3题:

    Given  1.  public class Foo {  2.  public static void main (String [] args) }  3.  try { return;}  4.  finally { Syste.out.printIn (“Finally”);}  5. }  6. }   What is the result( )?

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Finally”.
    • C、 The code comiles. But an exception is thrown at runtime.
    • D、 The code will not compile because the catch block is missing.

    正确答案:B

  • 第4题:

    Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result?()

    • A、Compilation fails.
    • B、An exception is thrown at runtime.
    • C、The variable first is set to null.
    • D、The variable first is set to elements[0].

    正确答案:D

  • 第5题:

    单选题
    public class TestOne {  public static void main (String[] args) throws Exception {  Thread.sleep(3000);  System.out.println(”sleep”);  }  }  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.


    正确答案: A
    解析: 暂无解析

  • 第6题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The code executes and prints "running".

    D

    The code executes and prints "runningrunning".

    E

    The code executes and prints "runningrunningrunning".


    正确答案: C
    解析: 暂无解析

  • 第7题:

    单选题
    Click the Exhibit button. Given this code from Class B: 25.A a1 = new A(); 26.A a2 = new A(); 27.A a3 = new A(); 28.System.out.println(A.getInstanceCount()); What is the result?()
    A

    Compilation of class A fails.

    B

    Line 28 prints the value 3 to System.out.

    C

    Line 28 prints the value 1 to System.out.

    D

    A runtime error occurs when line 25 executes.

    E

    Compilation fails because of an error on line 28.


    正确答案: D
    解析: 暂无解析

  • 第8题:

    单选题
    Click the Exhibit button.   Given this code from Class B:   25. A a1 = new A();   26. A a2 = new A();   27. A a3 = new A();   28. System.out.println(A.getInstanceCount());   What is the result?()
    A

     Compilation of class A fails.

    B

     Line 28 prints the value 3 to System.out.

    C

     Line 28 prints the value 1 to System.out.

    D

     Compilation fails because of an error on line 28.

    E

     A runtime error occurs when line 25 executes.


    正确答案: E
    解析: 暂无解析

  • 第9题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    doStuff x = 6 main x = 6

    D

    doStuff x = 6 main x = 7

    E

    doStuff x = 7 main x = 6


    正确答案: A
    解析: 暂无解析

  • 第10题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The code executes normally and prints "bar".

    D

    The code executes normally, but nothing prints.


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    Given  1.  public class Foo {  2.  public static void main (String [] args) }  3.  try { return;}  4.  finally { Syste.out.printIn (“Finally”);}  5. }  6. }   What is the result( )?
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Finally”.

    C

     The code comiles. But an exception is thrown at runtime.

    D

     The code will not compile because the catch block is missing.


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    Given: What is the result?()
    A

    Hello

    B

    Hello World

    C

    Compilation fails.

    D

    Hello World 5

    E

    The code runs with no output.

    F

    An exception is thrown at runtime.


    正确答案: E
    解析: 暂无解析

  • 第13题:

    public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Finally”
    • C、 The code compiles, but an exception is thrown at runtime.
    • D、 The code will not compile because the catch block is missing.

    正确答案:B

  • 第14题:

    public class TestOne {  public static void main (String[] args) throws Exception {  Thread.sleep(3000);  System.out.println(”sleep”);  }  }  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.

    正确答案:C

  • 第15题:

    public class Threads4 {  public static void main (String[] args) {  new Threads4().go();  }  public void go() {  Runnable r = new Runnable() { public void run() {  System.out.print(”foo”);  }  };  Thread t = new Thread(r);  t.start();  t.start();  }  }  What is the result?() 

    • A、 Compilation fails.
    • B、 An exception is thrown at runtime.
    • C、 The code executes normally and prints „foo”.
    • D、 The code executes normally, but nothing is printed.

    正确答案:B

  • 第16题:

    单选题
    public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The code executes and prints “running”.

    D

     The code executes and prints “runningrunning”.

    E

     The code executes and prints “runningrunningrunning”.


    正确答案: D
    解析: 暂无解析

  • 第17题:

    单选题
    Click the Exhibit button. Given: ClassA a = new ClassA( ); a.methodA( ); What is the result? ()
    A

    Compilation fails.

    B

    ClassC is displayed.

    C

    The code runs with no output.

    D

    An exception is thrown at runtime.


    正确答案: B
    解析: 暂无解析

  • 第18题:

    单选题
    public class TestOne implements Runnable {  public static void main (String[] args) throws Exception {  Thread t = new Thread(new TestOne());  t.start();  System.out.print(”Started”);  t.join();  System.out.print(”Complete”);  }  public void run() {  for (int i= 0; i< 4; i++) {   System.out.print(i);  }  }  }  What can be a result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The code executes and prints “StartedComplete”.

    D

     The code executes and prints “StartedComplete0123”.

    E

     The code executes and prints “Started0l23Complete”.


    正确答案: E
    解析: 暂无解析

  • 第19题:

    单选题
    public class Threads4 {  public static void main (String[] args) {  new Threads4().go();  }  public void go() {  Runnable r = new Runnable() { public void run() {  System.out.print(”foo”);  }  };  Thread t = new Thread(r);  t.start();  t.start();  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The code executes normally and prints „foo”.

    D

     The code executes normally, but nothing is printed.


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    public class Threads5 {  public static void main (String[] args) {  new Thread(new Runnable() {  public void run() {  System.out.print(”bar”);  } }).start();  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The code executes normally and prints “bar”.

    D

     The code executes normally, but nothing prints.


    正确答案: A
    解析: 暂无解析

  • 第21题:

    单选题
    public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Finally”

    C

     The code compiles, but an exception is thrown at runtime.

    D

     The code will not compile because the catch block is missing.


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    Given: What is the result?()
    A

    The code runs with no output.

    B

    An exception is thrown at runtime.

    C

    Compilation fails because of an error in line 20.

    D

    Compilation fails because of an error in line 21.

    E

    Compilation fails because of an error in line 23.

    F

    Compilation fails because of an error in line 25.


    正确答案: F
    解析: 暂无解析

  • 第23题:

    单选题
    1. public class A {  2. void A() {  3. System.out.println(“Class A”);  4. }  5. public static void main(String[] args) {  6. new A();  7. }  8. }  What is the result?()
    A

     Class A

    B

     Compilation fails.

    C

     An exception is thrown at line 2.

    D

     An exception is thrown at line 6.

    E

     The code executes with no output.


    正确答案: E
    解析: 暂无解析