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

What is a class reference?

1107


Explain creating threads by implementing runnable class?

1175


What is the purpose of main function in java?

1031


What is an escape character in java?

1039


What is reverse function?

1140


What is the difference between pass by reference and pass by pointer?

1105


What is a class object?

975


What is difference between fail-fast and fail-safe?

1241


What is abstract class? Explain

1046


What are selection structures?

1003


Give an example of call be reference significance.

1034


What is identifier give example?

1035


What is string array?

1071


Is it possible for a yielded thread to get chance for its execution again?

944


What is a text string?

1090