What are synchronized methods and synchronized statements?

Answers were Sorted based on User's Feedback



What are synchronized methods and synchronized statements?..

Answer / tarunam verma

Syncronized methods are executed only after a lock is
acheived on the classes or objects specified in the methids
and after that the methids are executed

synchronized statements are the synchronised the bolck
containg the lock on some resource, statment in that block
are called synchronised statements

Is This Answer Correct ?    4 Yes 0 No

What are synchronized methods and synchronized statements?..

Answer / sainaveen

Syncronized methods are executed only after a lock is
acheived on the classes or objects specified in the methids
and after that the methids are executed

Synchronized methods are executed after lock is acieved on
class or object specified in the synchronized statement

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More Advanced Java Interview Questions

1) which method of the RequestDispatcher cannot be called once the output is sent to the client? a. forward b. include c. both a&b 2) which interface should an object implement to get notified of changes to the list of active sessions in a web application? a. HttpSessionListener b. HttpSessionActivationListener c. HttpSessionAttributeLIstener 3) A user can select multiple locations from a list box on an HTML form, which of the following methods can be used to retrieve all the selected location? a. getParameter() b. getParameterValues() c. getParamValues() 4) which of the following methods should be used to send character text to the client? a. ServletResponse.getWriter() b. ServletResponse.getOutputStream() c. ServletResponse.getOut() 5) which implicit object is always available in a JSP page? a. exception b. session c. out 6) which inclusion mechanism doesn't include the source of the page, rather the output of the page. a. include directive b. jsp:include action c. Bothe a& b 7) which attribute of the page controls whether a page participates in session or not? a. session-allowed b. session c. isSession

1 Answers  


What is the purpose of the notify() method?

0 Answers  


What is the relation between the infobus and rmi?

0 Answers  


What are the implicit objects?

2 Answers   HCL,


What is the difference between session and entity beans?

0 Answers  






How can a dead thread be restarted?

1 Answers   IBM, Wipro,


Can we sent objects using Sockets?

0 Answers  


how to create Calculator GUI using Gridbaglayout as like as Window Calculator??????????? (Open calculator Go-->Run-->type calc-->Enter)

1 Answers   TCS,


How u validate date in DD/MM/YY format. and how u validate money in ur jsp

3 Answers   Ashok Leyland, Satyam, Tech Mahindra, Tomax,


Why is string immutable in java?

0 Answers  


What are preemptive scheduling and time slicing and what is the difference between them?

1 Answers  


What is servlet preinitialization?

3 Answers   iFlex,


Categories