Friday, 16 December 2016

Java Tutorial: Java Threads (Thread priority in java | Java Thread priority | Default priority)


Click here to watch in Youtube : 
https://www.youtube.com/watch?v=HMQHuoJFIPM&list=UUhwKlOVR041tngjerWxVccw

DisplayThread.java
class DisplayThread extends Thread
{

    public static void main(String args[])
    {
        DisplayThread displayThread1 = new DisplayThread();
        DisplayThread displayThread2 = new DisplayThread();

        displayThread1.start();
        displayThread2.start();
    }

    public void run()
    {
        System.out.println("Thread name =" + Thread.currentThread().getName()
                + ", Thread Priority = " + Thread.currentThread().getPriority()
                + "\n");

    }
}
Output
Thread name =Thread-1, Thread Priority = 5

Thread name =Thread-0, Thread Priority = 5
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ThreadDemo_default_priority_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ThreadDemo_default_priority_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2bc24748fe4193d8423018abb163c74598759d97/BasicJava/ThreadDemo_default_priority_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge