black

SCJP程序员认证考试

登录

单项选择题

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

A. 4
B. 5
C. 8
D. 9
E. Compilation fails.
F. An exception is thrown at runtime.
G. It is impossible to determine for certain.

相关考题

单项选择题 Runnable r = new Runnable() {  public void run() {  System.out.print(”Cat”);  }  };  Threadt=new Thread(r) {  public void run() {  System.out.print(”Dog”);  }  };  t.start();  What is the result?()

单项选择题 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?()

单项选择题 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?()

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

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064