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 are static variables and functions?

1060


Which is better singleton or static class?

919


Why is string buffer better than string ?

1039


Which of the classes will have more memory allocated?

913


How many boolean functions are there?

922


How to split a string in java?

1066


Is string a class?

969


What happens to the Exception object after handling an exception?

2323


What is collection class in java?

930


What is difference between equal and == in java?

905


What is meant by inheritance and what are its advantages?

1040


When to use runnable interface vs thread class in java?

931


What is sortedset in java?

976


What is the difference between stringbuffer and stringbuilder?

983


What is math floor in java?

883