Click here to Skip to main content
15,885,366 members
Home / Discussions / Java
   

Java

 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Mycroft Holmes14-Oct-18 13:12
professionalMycroft Holmes14-Oct-18 13:12 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Eddy Vluggen15-Oct-18 0:53
professionalEddy Vluggen15-Oct-18 0:53 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
#realJSOP5-Nov-18 4:33
mve#realJSOP5-Nov-18 4:33 
QuestionDaemon Thread Pin
ashutoshgadgil11-Oct-18 21:50
ashutoshgadgil11-Oct-18 21:50 
AnswerRe: Daemon Thread Pin
Richard MacCutchan11-Oct-18 22:34
mveRichard MacCutchan11-Oct-18 22:34 
QuestionJava SE 8 OCA Exam Pin
Willem Voigt9-Oct-18 1:34
Willem Voigt9-Oct-18 1:34 
AnswerRe: Java SE 8 OCA Exam Pin
Richard MacCutchan9-Oct-18 5:29
mveRichard MacCutchan9-Oct-18 5:29 
QuestionThreads Priority Pin
ashutoshgadgil8-Oct-18 22:46
ashutoshgadgil8-Oct-18 22: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 MacCutchan8-Oct-18 23:01
mveRichard MacCutchan8-Oct-18 23:01 
GeneralRe: Threads Priority Pin
ashutoshgadgil9-Oct-18 6:45
ashutoshgadgil9-Oct-18 6:45 
GeneralRe: Threads Priority Pin
Richard MacCutchan9-Oct-18 7:03
mveRichard MacCutchan9-Oct-18 7:03 
QuestionProject execution Pin
Member 138896166-Oct-18 8:46
Member 138896166-Oct-18 8:46 
AnswerRe: Project execution Pin
OriginalGriff6-Oct-18 8:48
mveOriginalGriff6-Oct-18 8:48 
QuestionDeclaring one variable as multiple things. How? Pin
Member 1397832611-Sep-18 21:02
Member 1397832611-Sep-18 21:02 
AnswerRe: Declaring one variable as multiple things. How? Pin
Richard MacCutchan11-Sep-18 21:24
mveRichard MacCutchan11-Sep-18 21:24 
QuestionHow to add a toolbar to JInternalFrame ? Pin
Withanam5-Sep-18 0:42
Withanam5-Sep-18 0:42 
AnswerRe: How to add a toolbar to JInternalFrame ? Pin
Richard MacCutchan5-Sep-18 0:50
mveRichard MacCutchan5-Sep-18 0:50 
QuestionJavaFX DatePicker update value to null [SOLVED] Pin
Valentinor3-Sep-18 1:11
Valentinor3-Sep-18 1:11 
AnswerRe: JavaFX DatePicker update value to null Pin
Valentinor29-Sep-18 6:53
Valentinor29-Sep-18 6:53 
QuestionJava cv Pin
Member 1391875527-Aug-18 17:53
Member 1391875527-Aug-18 17:53 
AnswerRe: Java cv Pin
Richard MacCutchan27-Aug-18 22:01
mveRichard MacCutchan27-Aug-18 22:01 
AnswerRe: Java cv Pin
GiteHrudaya25-Nov-18 22:15
GiteHrudaya25-Nov-18 22:15 
QuestionJavaFX program exit without Java JDK installed [SOLVED] Pin
Valentinor25-Aug-18 9:22
Valentinor25-Aug-18 9:22 
QuestionRe: JavaFX program exit without Java JDK installed Pin
Richard MacCutchan25-Aug-18 1:33
mveRichard MacCutchan25-Aug-18 1:33 
AnswerRe: JavaFX program exit without Java JDK installed Pin
Valentinor25-Aug-18 3:06
Valentinor25-Aug-18 3: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.