Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Source code:

class Dollar extends Thread


{
public void run()
{
for(int i=1;i<=10;i++)
{
System.out.print("$");
try
{
Thread.sleep(500);
}
catch(InterruptedException e)
{
System.out.println("Thread Number interrupted");
}
}
}
}

class Hash extends Thread


{
public void run()
{
for(int i=1;i<=10;i++)
{
System.out.print("#");
try
{
Thread.sleep(500);
}
catch(InterruptedException e)
{
System.out.println("Thread Alphabet interrupted");
}
}
}
}

class EXP13
{
public static void main(String args[])
{
Dollar t1=new Dollar();
t1.start();

Hash t2 =new Hash();


t2.start();
}
}

Output:

$#$#$#$#$#$#$#$#$#$#

You might also like