public class cl extends Thread{
public void run(){
for(int i=1;i<5;i++){
try{
Thread.sleep(300);
}
catch(InterruptedException e)
{System.out.println(e);}
System.out.println(i);
}
}
public static void main(String args[]){
cl t1=new cl();
cl t2=new cl();
t1.start();
t2.start();
}
}
public void run(){
for(int i=1;i<5;i++){
try{
Thread.sleep(300);
}
catch(InterruptedException e)
{System.out.println(e);}
System.out.println(i);
}
}
public static void main(String args[]){
cl t1=new cl();
cl t2=new cl();
t1.start();
t2.start();
}
}
$javac cl.java $java -Xmx128M -Xms16M cl 1 1 2 2 3 3 4 4
No comments:
Post a Comment