public interface Notify{
public void perform(result);
}
public class MainThread implements Notify{
public synchronized void perform(result){
System.out.print(result);
}
public void doCal(){
new SubThread(this).start();
}
}
public class SubThread extends Thread{
private Notify notify;
public SubThread(Notify notify){
this.notify = notify;
}
public void run(){
.....
notify.perform(result);
}
}
public void perform(result);
}
public class MainThread implements Notify{
public synchronized void perform(result){
System.out.print(result);
}
public void doCal(){
new SubThread(this).start();
}
}
public class SubThread extends Thread{
private Notify notify;
public SubThread(Notify notify){
this.notify = notify;
}
public void run(){
.....
notify.perform(result);
}
}