Sunday, 18 December 2022

Multithreading 1) Java program to illustrate and defining thread by Extending thread class.

 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

GitHub Most Imp Command For Every Developer Learn:

 Top Command for GitHub:  1) git clone 2) git init and git status   3) git add file name  or git add .  4) git commit -m message  5) git rem...