SHOWING THE MULTIPLE EXCUTION OF TASK
SINGLE TASKING USING THREAD
class MyThread implements Runnable{
public void run()
{
task1();
task2();
task3();
}
void task1()
{System.out.println("task1");}
void task2()
{System.out.println("task2");}
void task3()
{System.out.println("task3");}
}
class Single{
public static void main(String[]args)
{
MyThread mt=new MyThread();
Thread t=new Thread(mt);
t.start();
}
}
0 comments:
Post a Comment