PROGRAM TO IMPLEMENT RUNNABLE INTERFACE

//PROGRAM TO IMPLEMENT RUNNABLE INTERFACE
class X implements Runnable
{
public void run( )
{
for(int i=1;i<=10;i++)
{
System.out.println(“\t thread X: “+i);
}
System.out.println(“End of thread X”);
}
}
class runnableTest
{
public static void main(String args[ ])
{
X runnable=new X( );
Thread threadX=new Thread(runnable);
threadX.start( );
System.out.println(“End of main Thread”);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *