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

Can we write class inside a class in java?

1028


how can i use a nonsynchronized hashtable?

2623


What is the default value of byte datatype in java?

974


Explain how can you debug the Java code?

1113


What is subsequence of a string?

1149


Why should we use singleton pattern instead of static class?

968


what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

1030


What is a “stateless” protocol ?

1034


What does serializing data mean?

1001


What do you understand by abstract classes?

1132


What is an iterator interface in java programming?

1017


Is minecraft 1.15 out?

1011


Is ruby built on java?

984


What is thread pool in java with example?

1061


What is the purpose of object oriented programming?

1031