Questions that most Java candidates answer wrongly

Upasana | December 16, 2017 | 1 min read | 174 views

There are few questions for which I rarely find right answer from the interview Candidates, here is the list ..

  1. Is it required to synchronize the accessor of a shared mutable object in case of multi-threading? And why?

  2. In which scenario StringBuilder should be preferred over String class?

  3. I am working on an application where millions of temporary StringBuilder objects are being created, due to which app is facing large GC pauses, how would you rectify the problem, assuming that memory available can not be increased to great extent.

  4. How Atomic updates are different from their synchronized counterpart?

  5. When do we get the ConcurrentModificationException? What constitutes the structural modifications in a collection?

  6. Is it possible to write a method in Java which can swap two int variable? What if we change the type from int to Integer?

  7. What is difference between Class and the Instance level locking?

  8. Can you prove a scenario where thread starvation occurs?

  9. Is it a mandate to make all fields final inside a immutable class? If yes, why?

  10. How to fix Double Check Locking (DCL multi-threading singleton problem)?

  11. What is Java Memory Model ? Who should read it?

  12. What is upper bound and lower bound in generics?

  13. What happens when an exception is thrown from a try block which has no catch clause. But in finally block, a value is returned by the method? Discuss the scenario.

Top articles in this category:
  1. Sapient Global Market Java Interview Questions and Coding Exercise
  2. Goldman Sachs Java Interview Questions
  3. UBS Java Interview Questions
  4. Morgan Stanley Java Interview Questions
  5. Citibank Java developer interview questions
  6. RBS Java Programming Interview Questions
  7. ION Trading Java Interview Questions

Recommended books for interview preparation:

Find more on this topic:
Buy interview books

Java & Microservices interview refresher for experienced developers.