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

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


参考解析

解析: 暂无解析

相关考题:

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.

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

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.

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 AB、 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.

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.

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.

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

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.

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.

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.

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

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

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

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

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

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

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

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

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

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

单选题Given: What is the result?()A Compilation fails.B An exception is thrown at runtime.C doStuff x = 6 main x = 6D doStuff x = 6 main x = 7E doStuff x = 7 main x = 6

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

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

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

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

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

单选题Given: What is the result?()A HelloB Hello WorldC Compilation fails.D Hello World 5E The code runs with no output.F An exception is thrown at runtime.