• Post Reply Bookmark Topic Watch Topic
  • New Topic

Plz Tell Ans  RSS feed

 
senthil.sona kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is Synchronized method and Synchronized block?

Need Full Description

[ EJFH: Remove invitation to take discussion offline; we don't do that here.]
[ July 05, 2006: Message edited by: Ernest Friedman-Hill ]
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/* synch method */
public synchronized void methodName() {
//DO SOMETHING SYNCHRONIZED
}




/* synch block */
private List list = new LinkedList();

synchronized (list) {
//ALL ACCESS TO list IS SYNCHRONIZED
}
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this: The Java Tutorial - Locking an Object

NOTE: Please use a more meaningful subject line than "Plz Tell Ans" next time. For example "How does synchronization work?" would have been a lot better.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!