// sleep method
public class thr3 extends Thread
{ int i;
public void run()
{
for (i=1;i<6;i++)
{
System.out.println(i);
try
{
Thread.sleep(1000);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public static void main (String arg[])
{
thr3 x= new thr3();
x.start();
}
}
public class thr3 extends Thread
{ int i;
public void run()
{
for (i=1;i<6;i++)
{
System.out.println(i);
try
{
Thread.sleep(1000);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public static void main (String arg[])
{
thr3 x= new thr3();
x.start();
}
}
No comments:
Post a Comment