class MyThread extends Thread {
public void run() {
System.out.println("run method");
System.out.println("run method priority: " + Thread.currentThread().getPriority());
Thread.currentThread().setPriority(4);
System.out.println("run method priority after setting: " + Thread.currentThread().getPriority());
}
public static void main(String[] args) {
System.out.println("main method");
System.out.println("main method priority before setting: " + Thread.currentThread().getPriority());
Thread.currentThread().setPriority(9);
System.out.println("main method priority after setting: " + Thread.currentThread().getPriority());
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter