class ta extends Thread{
public void run(){
for(int i=1;i<=10;i++) {
try {
System.out.print(i);
Thread.sleep(10); // milisecond
}catch (InterruptedException e) { }
}
}
}
class tb extends Thread{
public void run(){
for(int i=1;i<=10;i++) {
try {
System.out.println(i);
Thread.sleep(20); // milisecond
}catch (InterruptedException e) { }
}
}
}
class tc extends Thread{
public static void main(String a[]){
ta xta = new ta();
xta.start();
tb xtb = new tb();
xtb.start();
}
}
|