Program to Implement Thread using Runnable Interface
class A implements Runnable
{
public void run()
{
for(int i=0; i<20; i++)
{
System.out.println(i);
}
}
}
class Run1
{
public static void main(String args[])
{
A a1 = new A();
Thread t = new Thread(a1);
t.start();
}
}
class A implements Runnable
{
public void run()
{
for(int i=0; i<20; i++)
{
System.out.println(i);
}
}
}
class Run1
{
public static void main(String args[])
{
A a1 = new A();
Thread t = new Thread(a1);
t.start();
}
}
No comments:
Post a Comment