Java Thread getPriority() methodThe getPriority() method of thread class is used to check the priority of the thread. When we create a thread, it has some priority assigned to it. Priority of thread can either be assigned by the JVM or by the programmer explicitly while creating the thread. The thread's priority is in the range of 1 to 10. The default priority of a thread is 5. SyntaxReturnIt returns the thread's priority. ExampleTest it NowOutput: t1 thread priority : 5 t2 thread priority : 5 running thread name is:Thread-0 running thread name is:Thread-1 Next TopicMultithreading in Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India