Home » Sometech » WAP in JAVA that creates three threads.

WAP in JAVA that creates three threads.

Java Coding

class t1 extends Thread
{
public void run()
{
try
{

Thread.sleep (1000);
        System.out.println(“Good Morning”);
}
catch(Exception l)
{
System.out.println(l);
}
}

}
class t2 extends Thread
{
public void run()
{
try
{
Thread.sleep (2000);
System.out.println(“hello”);
}
catch(Exception l)
{
System.out.println(l);
}
}

}
class t3 extends Thread
{
public void run()
{
try
{
Thread.sleep (3000);
System.out.println(“WelCome”);
}
catch(Exception l)
{
System.out.println(l);
}
}

}
class hello11
{
public static void main(String arg[])
{
t1 o=new t1();
t2 o1= new t2();
t3 o2= new t3();
o.start();
o1.start();
o2.start();
}

}

Advertisements

SoME Tech

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: