Hi,
looks MG has changed some Q to
thread Q in his Mock1.
ok the foll
Which of the following statements about this code are true?
public class Morecombe{
public static void main(
String argv[]){
Morecombe m = new Morecombe();
m.go(new Turing(){});
}
public void go(Turing t){
t.start();
}
}
class Turing extends Thread{
public void run(){
for(int i =0; i < 2; i++){
System.out.println(i);
}
}
}
1) Compilation error due to malformed parameter to go method
2) Compilation error, class Turing has no start method
3) Compilation and output of 0 followed by 1
4) Compilation but runtime error
Answer is 3.
I did not understand how could you pass m.go( new turing(){});
I thought it would be a compile time error but giving an output of 0 1.
Can anybody throw some light on this.
Regards,
madhuri.