Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Lock

 
Mohit Agarwal
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class A{
static void synchronized void call() {
}
synchronized void call(){}
}

One lock will be needed for the class and also a lock is needed for the instance when invoking call().

Are they independent of each other or mutually exclusive?

Mohit Agarwal
Would Be SCJP.

"The will to win is worthless if you do not have the will to prepare"
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are independent locks. By the way your code will not compile for two reasons. Can you see them?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic