Create Thread using Java in NetBeans
public class p33_thread extends Thread {
public void run()
{
for(int i=0;i<5;i++)
{
try
{
Thread.sleep(1000);
}
catch(InterruptedException e)
{
System.out.println(e);
}
System.out.println(i);
}
}
public static void main(String[] args) {
p33_thread t1 = new p33_thread();
t1.start();
}
}
public void run()
{
for(int i=0;i<5;i++)
{
try
{
Thread.sleep(1000);
}
catch(InterruptedException e)
{
System.out.println(e);
}
System.out.println(i);
}
}
public static void main(String[] args) {
p33_thread t1 = new p33_thread();
t1.start();
}
}