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

Can we use a switch statement with strings?

1040


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

2028


What are the differences between checked exception and unchecked exception?

958


Why is the main method declared static?

1121


What is a programming object?

1098


What is anti pattern in programming?

964


What is the this keyword?

1024


Is constructor inherited?

956


Why is singleton instance static?

990


How to read and write image from a file ?

1040


What is thread safe java?

911


How many bits is a string in java?

1018


What do you mean by checked exceptions?

954


What is treeset in java?

989


What must a class do to implement an interface in java programming?

1048