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 / vikki

There are two ways to syanchronize access to an object

1st one is using synchronized keyword for example

Synchronized type methodname(arg-list)
{
//synchrinized method body
}

2nd way s using synchronized block

synchronized(object)
{
//synchronized statement

}

Is This Answer Correct ?    30 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to reverse a string in java?

1024


What is assembly language?

939


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

956


What is the difference between iterator and enumeration ?

975


Tell me how many ways are there to initialise an integer with a constant.

1072


What does three dots mean in java?

1073


Explain scope or life time of local variables in java?

987


What is the final variable?

1186


Why is core java important?

1004


How do you create a null object?

1039


What do you mean by light weight and heavy weight components?

982


What is a pattern what is an anti pattern?

899


What is fundamental datatype?

948


What is thread pool in java with example?

962


How to split a string in java?

1084