answersLogoWhite

0

A Synchronized block is a block of code enclosed by the {} braces that has a synchronized keyword before it. This block of code is similar to a synchronized method and only one thread can access it at a time.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How you make shared and synchronized variable in java thread?

A Variable that is shared as well as synchronized cannot be created in Java. These two terms are mutually exclusive and a variable that is synchronized in java cannot be shared and vice versa


What is synchronized object in java?

synchronisation means one resource should use one system at a time


What are the synchronized methods and synchronized statements in java?

Synchronized Methods are methods that have the keyword synchronized in the method signature. Synchronized statements are pieces of java code that are surrounded by brackets which have the keyword synchronized qualifying them. Both cases mean that - only one thread will be able to access the method or the statement that is synchronized


How does one get java synchronized?

The Java program needs to be synchronized. Doing so can be complicated, but can be done. The best way to synchronize would be using the website and walk through the steps.


What is synchronize in java?

Synchronization is a feature by which only one thread can access a resource in a particular time of instance. No other thread can interrupt for that resource. In java to make our method synchronize we use synchronized keyword with that method. So Synchronization is just managing the resources among Threads. Vijai Shanker Just to add with the invent of Java 5 we have more option to write synchronized code in Java instead of using synchronized keyword we can use Lock Classes available in concurrency package.


What is the use of catch block in java?

the catch block catches the exception from the try block to display a proper message about the exception. Answered by, SOORAJ.M.S


How you use if condition in java?

The if block is used in java to check a true or false condition. for ex: if(age > 18) { system.out.println("You are an Adult"); } else { system.out.println("Sorry, you are still a kid"); }


What are block of statements in java?

In computer programming, a block or code block is a lexical structure of source code which is grouped together. In Java it is sed in the same way: to group code and separate it from the rest.


Why use catch keyword in java?

no, because catch is used to handle exceptions which are generated from try block


Can a method be static and synchronized?

Yes. In Java methods can be static and synchronized. Static methods access other static members in the class. Static in case of inheritance are treated as non - static. Synchronized methods are those which have dedicated thread attached to it and no other can access until currrent thread leaves the control from it.


Why use throw in java in compare try-catch?

we use throws in our program so that we dont need to write try & catch block & to avoid the exception


Can you use pointers in java?

Java does not support Pointers and hence you cannot use it in Java.