class LastThread extends Thread{
LastThread(){
/*konstruktor*/
}
public void run(){
int i;
for(i=0; i<=10;i++){
System.out.println("proses LastThread");
try{
sleep(1000);
}
catch(Exception e){
e.printStackTrace();
}
}
}
}
class NewThread implements Runnable{
Thread t;
NewThread(){
/*konstruktor*/
t = new Thread(this);
t.start();
}
public void run(){
int i;
for(i=0; i<=10;i++){
System.out.println("proses NewThread");
try{
t.sleep(1000);
}
catch(Exception e){
e.printStackTrace();
}
}
}
}
class CobaThread{
public static void main(String[] args) {
LastThread lt = new LastThread();
lt.start();
NewThread nt = new NewThread();
}
}