GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java-Work/Question55.java at master · Animesh-Ghosh/Java-Work Expand file tree/ Copy pathQuestion55.javaMore file actions 35 lines (33 loc) · 981 Bytes / Copy pathQuestion55.javaFile metadata and controls35 lines (33 loc) · 981 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 /* program to demonstrate use of setPriority () method to set priority of a thread to 1, 10 and normal */ class threadPriority extends Thread { threadPriority (String str) { super (str); } public void run () { System.out.println ("Running thread name is " + this.getName ()); System.out.println ("Running thread priority is " + this.getPriority ()); try { for (int i = 1; i <= 5; i++) { System.out.println ("Thread " + this.getName () + ": " + i); Thread.sleep (500); } } catch (InterruptedException ie) { System.out.println (this.getName () + " interrupted!"); } } } class Question55 { public static void main(String[] args) { threadPriority t1 = new threadPriority ("A"); threadPriority t2 = new threadPriority ("B"); threadPriority t3 = new threadPriority ("C"); t1.setPriority (Thread.MIN_PRIORITY); t2.setPriority (Thread.NORM_PRIORITY); t3.setPriority (Thread.MAX_PRIORITY); t1.start (); t2.start (); t3.start (); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |