This is related to threads. I have a class with synchronized
method m1(). Can I create different instances of this class
and execute the m1() for different threads?

Answer Posted / shashidhar

When a thread enters the Synchronized method the object on
this the method is called gets locked so no other thread
cannot cal that or any other method on same object.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bufferedwriter?

540


Can we force the garbage collection to run?

534


What is double data type?

537


What is the use of protected in java?

532


What are different types of classloaders?

585






What is difference between static and abstract class?

516


What is the byte range?

578


What are the advantages of java over cpp?

551


What about main thread in java?

646


What is a boolean used for?

586


What is variable in java?

520


I want to persist data of objects for later use. What’s the best approach to do so?

498


what is mena by object block any what is the use of that

1770


What does it mean that a method or field is “static”?

547


What are the different access modifiers available in java?

559