This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Threads" Watch "Threads" New topic
Author

Threads

Vihanga Rajalingam
Greenhorn

Joined: Aug 26, 2012
Posts: 3

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?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18550
    
  40

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://www.coderanch.com/how-to/java/TellTheDetails

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

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
Don't get me started about those stupid light bulbs.
 
subject: Threads
 
Similar Threads
Threads
Doubt in one question
Instance variables during Threads
Regarding Synchronization
Threads