//Test.java
class simpleThread extends Thread
{
public simpleThread(String str)
{
super(str);
}
public void run()
{
for(int i=0;i<5;i++)
System.out.println(i +": Thread Name: " + getName());
{
try{
sleep(1000);
}
catch(Exception e){System.out.println(e);}
}
}
}
class Test
{
public static void main(String abc[])
{
System.out.println("-----------------------------------------------------------");
new simpleThread("A").start();
new simpleThread("B").start();
}
}
class simpleThread extends Thread
{
public simpleThread(String str)
{
super(str);
}
public void run()
{
for(int i=0;i<5;i++)
System.out.println(i +": Thread Name: " + getName());
{
try{
sleep(1000);
}
catch(Exception e){System.out.println(e);}
}
}
}
class Test
{
public static void main(String abc[])
{
System.out.println("-----------------------------------------------------------");
new simpleThread("A").start();
new simpleThread("B").start();
}
}
No comments:
Post a Comment