How to setPriority of Thread Class?

In this blog, we will see Thread Class and its object, we also see setPriority and setName method for setting of thread properties.

Let’s see example and video on Thread Class.

package examples;

public class Thread2


                public static void main(String[] args)


                                Thread t = Thread.currentThread();         // Process of creating an object



                                // Change Name of thread and priority of thread

                                t.setName(“Process -1”);

                                t.setPriority(10);               // 1  to 10



                                Thread t1 = new Thread();





Thread [main, 5, main]

Thread [Process-1, 10, main]

Thread [Thread-0, 10, main]


Video available on YouTube.



If you have any query on blog example, you can directly comment us or subscribe our website

Earn Money Online

629total visits,8visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.


Link back if you want.

Enter Captcha Here :*

Reload Image