File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Head First Android 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: 19926
    
  43

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
 
It's not a secret anymore!