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...

What are the two ways you can synchronize a block of code?

Answer Posted / ajay tiwary

The way you can synchronize the block is:-

synchronized(dummy object)
{
//synchronized statement

}
In dummy object you can use this or u can create a dummy
object by using new Keyword.

What answer Vikki is posted as the first one is not the way
of synchronizing the block but it's a way to synchronizing
a method.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why stringbuffer is faster than string?

992


What does  mean in regex?

987


What is the significance of java packages?

1065


Explain the difference between the public, private, final, protected, and default modifiers?

984


What is the tradeoff between using an unordered array versus an ordered array?

1161


Can a class have multiple subclasses?

1051


Can we use String with switch case?

1108


What is update method called?

1089


what is thread? What are the high-level thread states? : Java thread

1215


What are reference variables in java?

1066


What is general methodology?

979


Explain the difference between throw and throws in java?

946


Can list be null in java?

986


What are static blocks and static initalizers in java ?

1013


Why is it important to initialize a variable?

938