black

SCJP程序员认证考试

登录

单项选择题

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

多项选择题 public class Threads2 implements Runnable {  public void nun() {  System.out.println(”run.”);  throw new RuntimeException(”Problem”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads2());  t.start();  System.out.println(”End of method.”);  }  }  Which two can be results?()

单项选择题 public class Starter extends Thread {  private int x= 2;  public static void main(String[] args) throws Exception {  new Starter().makeItSo();  }  public Starter() {  x=5;  start();  }  public void makeItSo() throws Exception {  join();  x=x- 1;  System.out.println(x);  }  public void run() { x *= 2; }  }  What is the output if the main() method is rum?()

All Rights Reserved 版权所有©考试题库网(kstiku.com)

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064