Sunday, 11 June 2017

Java Tutorial : Java Threads (How to create a thread in java | Thread creation in java) ~ foundjava

Click here to watch in Youtube : 

Click the below Image to Enlarge
Java Tutorial : Java Threads (How to create a thread in java | Thread creation in java) 
Java Tutorial : Java Threads (How to create a thread in java | Thread creation in java) 
DisplayThread.java
class DisplayThread extends Thread
{

    public static void main(String args[])
    {
        /*
         * Allocates a new Thread object.
         */
        DisplayThread displayThread = new DisplayThread();
        /*
         * Causes this thread to begin execution; the Java
         * Virtual Machine calls the run method of this
         * thread
         */
        displayThread.start();
    }

    /*
     * Subclasses of Thread should override run() method.
     */
    @Override
    public void run()
    {
        System.out.println("Welcome to india");
    }
}
Output
Welcome to india
Refer: 
https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/Thread.html
Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment