You are on page 1of 1

class A

{
void show()
{
for(int i=0;i<5;i++)
{
System.out.println("Hello");
try
{
Thread.sleep(500);
}
catch(InterruptedException e){}
}
}
}
class B
{
void show()
{
for(int i=0;i<5;i++)
{
System.out.println("Hi!");
try
{
Thread.sleep(500);
}
catch(interruptedException e){}
}
}
}
class DemoThread3
{
public static void main(String s[])
{
A aobj=new A();
B bobj=new B();
aobj.show();
bobj.show();
}
}

You might also like