Hi,
Look at the following code
class TSamp extends Thread{
public native
String getTime();
}
public class Multi implements Runnable {
boolean bStop;
public static void main(String argv[]){
Multi m = new Multi();
m.go();
}
public void go(){
TSamp ts = new TSamp(this);
ts.start();
bStop=true;
}
public void run(){
if(bStop==true){
return;
}
System.out.println("running");
}
}
The answer to this is given as compile time error during the creating of the new
thread in the go method.
As per my understanding a new thread object is created with a runnable as parameter which is quite fine and though the constructor is not defined in this class it would be inherited from the parent Thread class.
Please let me know where I missed.