Multithreading
Java program to illustrate and defining thread by Extending thread class.
class Test extends Thread
{
public void run()
{
System.out.println("Run method executed by child Thread");
}
public static void main(String[] args)
{
Test t = new Test();
t.start();
System.out.println("Main method executed by main thread");
}
}
OUTPUT: Main method executed by main thread
Run method executed by child Thread
No comments:
Post a Comment