8. What is the output if the main() method is run?
public class
Starter extends Thread{
private int k=2
public Static void
main(String[] args) throws Exception{
new
starter().makeItDo();
}
public Starter(){
k=5;
start();
}
public void
makeItDo() throws Exception{
join();
k=k-1;
System.out.println(k);
}
public void run(){
k*=2
}
}
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.
No comments:
Post a Comment