• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized method

 
Soumy Kumar
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I thought the answer was 4 but its mentioned 3 ...
can anyone clarify ??
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand "mutually exclusive" to mean that if you hold one lock, no thread can hold the other lock. This is not true of any locks in Java 1.4.

The correct answer is 3:
"The class wide lock and the instance lock being independent of each other."
 
Rubel Ahammad
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike is right.
static synchronized methods are independent of instance synchronized methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic