Java Thread.getPriority()
Syntax
Thread.getPriority() has the following syntax.
public final int getPriority()
Example
In the following code shows how to use Thread.getPriority() method.
// ww w. j ava 2 s.c o m
class ThreadDemo extends Thread{
public void run() {
System.out.println("Thread priority = " + getPriority());
}
}
public class Main {
public static void main(String args[]) {
Thread t = new Thread(new ThreadDemo(), "java2s.com thread");
t.setPriority(1);
System.out.println("thread = " + t);
t.start();
}
}