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

How many types of methods are there?

1044


What is mean by collections in java?

1167


How do you remove an element from an arraylist in java?

1001


what is the difference between thread and runnable types? : Java thread

996


Is array synchronized in java?

1036


Who is the owner of java?

997


What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?

974


Explain some best practices you would apply while using collection in java?

1028


How is string stored in java?

1060


What is a java lambda expression?

1042


Explain the difference between intermediate and terminal operations in java8?

1106


Write a java program to count the number of words present in a string?

980


What is getkey () in java?

1004


What is the function of compareto in java?

1043


What is hotjava?

1001