Threads in Java
import java.lang.*;
class TestThread extends Thread
{
public void start()
{
for(int x=1;x<6;x++)
{
double a=Math.random();
int b=(int)(a*100);
try
{
System.out.println(b);
Thread.sleep(100);
}catch(InterruptedException e){System.out.println(e.toString());}
}
}
public static void main(String ar[])
{
TestThread t1=new TestThread();
t1.start();
}
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment