Click here to Skip to main content
15,796,886 members
Home / Discussions / Java
   

Java

 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Mycroft Holmes14-Oct-18 14:12
professionalMycroft Holmes14-Oct-18 14:12 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Eddy Vluggen15-Oct-18 1:53
professionalEddy Vluggen15-Oct-18 1:53 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
#realJSOP5-Nov-18 5:33
mve#realJSOP5-Nov-18 5:33 
QuestionDaemon Thread Pin
ashutoshgadgil11-Oct-18 22:50
ashutoshgadgil11-Oct-18 22:50 
AnswerRe: Daemon Thread Pin
Richard MacCutchan11-Oct-18 23:34
mveRichard MacCutchan11-Oct-18 23:34 
QuestionJava SE 8 OCA Exam Pin
Willem Voigt9-Oct-18 2:34
Willem Voigt9-Oct-18 2:34 
AnswerRe: Java SE 8 OCA Exam Pin
Richard MacCutchan9-Oct-18 6:29
mveRichard MacCutchan9-Oct-18 6:29 
QuestionThreads Priority Pin
ashutoshgadgil8-Oct-18 23:46
ashutoshgadgil8-Oct-18 23:46 
Hello,

I have written the following code , here i am setting the priority of 3 threads ,As threads are executed according to highest priority But the output is not showing accordingly why is it??

package collection;

public class Pri extends Thread{

	public void run()
	{
		System.out.println(Thread.currentThread().getName()+" "+Thread.currentThread().getPriority());
	}
	
	
	public static void main(String[] args) {
		Pri p1=new Pri();
		Pri p2=new Pri();
		Pri p3=new Pri();
		
		p1.setPriority(2);
		p2.setPriority(4);
		p3.setPriority(6);
		
		p1.start();
		p2.start();
		p3.start();
		
		
		

	}

}


Output is :
Thread-0 2
Thread-1 4
Thread-2 6


As output should be like
Thread-2 6 Thread-1 4 Thread-0 2

AnswerRe: Threads Priority Pin
Richard MacCutchan9-Oct-18 0:01
mveRichard MacCutchan9-Oct-18 0:01 
GeneralRe: Threads Priority Pin
ashutoshgadgil9-Oct-18 7:45
ashutoshgadgil9-Oct-18 7:45 
GeneralRe: Threads Priority Pin
Richard MacCutchan9-Oct-18 8:03
mveRichard MacCutchan9-Oct-18 8:03 
QuestionProject execution Pin
Member 138896166-Oct-18 9:46
Member 138896166-Oct-18 9:46 
AnswerRe: Project execution Pin
OriginalGriff6-Oct-18 9:48
mvaOriginalGriff6-Oct-18 9:48 
QuestionDeclaring one variable as multiple things. How? Pin
Member 1397832611-Sep-18 22:02
Member 1397832611-Sep-18 22:02 
AnswerRe: Declaring one variable as multiple things. How? Pin
Richard MacCutchan11-Sep-18 22:24
mveRichard MacCutchan11-Sep-18 22:24 
QuestionHow to add a toolbar to JInternalFrame ? Pin
Withanam5-Sep-18 1:42
Withanam5-Sep-18 1:42 
AnswerRe: How to add a toolbar to JInternalFrame ? Pin
Richard MacCutchan5-Sep-18 1:50
mveRichard MacCutchan5-Sep-18 1:50 
QuestionJavaFX DatePicker update value to null [SOLVED] Pin
Valentinor3-Sep-18 2:11
Valentinor3-Sep-18 2:11 
AnswerRe: JavaFX DatePicker update value to null Pin
Valentinor29-Sep-18 7:53
Valentinor29-Sep-18 7:53 
QuestionJava cv Pin
Member 1391875527-Aug-18 18:53
Member 1391875527-Aug-18 18:53 
AnswerRe: Java cv Pin
Richard MacCutchan27-Aug-18 23:01
mveRichard MacCutchan27-Aug-18 23:01 
AnswerRe: Java cv Pin
GiteHrudaya25-Nov-18 23:15
GiteHrudaya25-Nov-18 23:15 
QuestionJavaFX program exit without Java JDK installed [SOLVED] Pin
Valentinor25-Aug-18 10:22
Valentinor25-Aug-18 10:22 
QuestionRe: JavaFX program exit without Java JDK installed Pin
Richard MacCutchan25-Aug-18 2:33
mveRichard MacCutchan25-Aug-18 2:33 
AnswerRe: JavaFX program exit without Java JDK installed Pin
Valentinor25-Aug-18 4:06
Valentinor25-Aug-18 4:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.