class NewThread extends Thread1
{
NewThread()
{
super("demo thread:");
System.out.println("child Thread:"+this);
start();
}
public void van()
{
try
{
for(int i=5;i>0;i--)
{
System.out.println("child Thread:"+i);
Thread.sleep(500);
}
}
catch(InterruptedException e)
{
System.out.println("child Thread");
}
System.out.println("exiting child");
}
}
class Three
{
public static void main(String str[])
{
new Thread();
try
{
for (int i=5;i>0;i--)
{
System.out.println("main Thread:"+i);
Thread.sleep(1000);
}
}
catch(interruptedException e)
{
System.out.println("main Thread......");
}
System.out.println("exiting Thread");
}
}
Please format indent your code properly and
This post has been edited by pbl: 23 August 2010 - 08:26 PM
Reason for edit:: Code tags added

New Topic/Question
Reply




MultiQuote



|