Java Threads Question:

Download Job Interview Questions and Answers PDF

Why would you use a synchronized block vs. synchronized method?

Java Threads Interview Question
Java Threads Interview Question

Answer:

Synchronized blocks place locks for shorter periods than synchronized methods.

Download Java Threads Interview Questions And Answers PDF

Previous QuestionNext Question
When you will synchronize a piece of your code?What is an objects lock and which objects have locks?