class mythreadone implements Runnable
{
public void run()
{
for(int i=1;i<=10;i++)
System.out.println(i);
try
{
Thread.sleep(400);
}
catch(Exception e)
{
}
}
}
class mythreadtwo implements Runnable
{
public void run()
{
for(int j=11;j<=20;j++)
System.out.println(j);
try
{
Thread.sleep(400);
}
catch(Exception e)
{
}
}
}
class runnableexample {
public static void main(String[] args) {
Thread rt1=new Thread(new mythreadone());
Thread rt2=new Thread(new mythreadtwo());
rt1.start();
rt2.start();
}
}
{
public void run()
{
for(int i=1;i<=10;i++)
System.out.println(i);
try
{
Thread.sleep(400);
}
catch(Exception e)
{
}
}
}
class mythreadtwo implements Runnable
{
public void run()
{
for(int j=11;j<=20;j++)
System.out.println(j);
try
{
Thread.sleep(400);
}
catch(Exception e)
{
}
}
}
class runnableexample {
public static void main(String[] args) {
Thread rt1=new Thread(new mythreadone());
Thread rt2=new Thread(new mythreadtwo());
rt1.start();
rt2.start();
}
}