Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How the threads are synchronized?

Answer Posted / seshadri pera

Threads are synchronized in two ways.

1) block level
2) Method level

Block level synhronization is the better performance
compare to method level.

Block Level:
see the code syntax for block level
synchronized {..
....//code to lock the specific object here..
...}

Method Level:
See the syntax
public void synchronized XXXMethodName(Parameters or
object to acquire locking){.....
...}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is a green thread? : Java thread

953


What is finally in Java?

1011


What is runtime polymorphism or dynamic method dispatch?

969


What is an enumeration?

1002


What is the exact difference in between unicast and multicast object? Where we will use?

938


Is object a data type?

917


What do you mean by static variable?

1014


What is an anonymous class in java?

1011


What is java used for on a computer?

925


How many types of java are there?

927


What are thread priorities and importance of thread priorities in java?

1061


Are strings immutable in java?

919


Is it possible to override private or static method in java?

939


what are abstract functions?

974


What are encapsulation, inheritance and polymorphism?

941