单选题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".

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

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

正确答案:E

第2题:

public class Test {   public static void main (String args) {  string foo = “blue”;  string bar = foo;   foo = “green”;   System.out.printIn(bar);   }   }   What is the result?()  

  • A、 An exception is thrown.
  • B、 The code will not compile.
  • C、 The program prints “null”
  • D、 The program prints “blue”
  • E、 The program prints “green”

正确答案:D

第3题:

Click the Exhibit button.Given:What is the result?()

A.Line 26 prints "a" to System.out.

B.Line 26 prints "b" to System.out.

C.An exception is thrown at line 26 at runtime.

D.Compilation of class A will fail due to an error in line 6.


参考答案:A

第4题:

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

第5题:

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

第6题:

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.

正确答案:C

第7题:

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

第8题:

Given: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 "Started0123Complete".


参考答案:E

第9题:

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

第10题:

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

更多相关问题