Forums Register Login

Threads

+Pie Number of slices to send: Send
class Demo{
public static void main(String args[]){
final A a1=new A();
final A a2=new A();
new Thread(){
public void run(){
synchronized(a1){
//if yield
synchronized(a2){
//
}
}
}
}.start();
//-----------------------
new Thread(){
public void run(){
synchronized(a2){
//if yield
synchronized(a1){
//
}
}
}
}.start();
}
}
class A{}


What does this program mean?
+Pie Number of slices to send: Send
 

Vihanga Rajalingam wrote:


What does this program mean?



You have to help us help you. There are lots of concepts going on in this example, and we have no idea of what your knowledge is? Do you know threading? If so, how much? Do you know what an inner class is? Please read this...

https://coderanch.com/how-to/java/TellTheDetails

Also take a look at other tips here ... https://coderanch.com/how-to/java/HowToAskQuestionsOnJavaRanch

Henry
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 745 times.
Similar Threads
Instance variables during Threads
Threads
Doubt in one question
Threads
Regarding Synchronization
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:26:28.