Interview questions you must go through before java interview

  1. How to move all 0s to the beginning and all 1s to the end of an array?
  2. Why is the main method in Java static?
  3. How do classes load in Java?
  4. What is the classpath and how does it differ from the system PATH?
  5. How many types of class loaders are there in Java?
  6. How would you update a value in a HashMap if a city’s name changes?
  7. Why are HashMap keys immutable?
  8. Can we override a static method in Java?
  9. Why can’t we override static methods?
  10. Can we overload static methods?
  11. Explain the Singleton design pattern.
  12. How can you make the Singleton pattern thread-safe with lazy loading and eager loading variations?
  13. Why do we use the synchronized keyword? What’s the alternative to synchronized?
  14. Tell me about a feature you developed in your previous Java project.
  15. Explain Microservices communication.
  16. How can you handle serving multiple requests in a web application?
  17. How and when do you use the this and super keywords in Java?
  18. Can you use this and super together?
  19. If both this and super are required in any scenario, how would you handle it?
  20. Can we rethrow an exception? How would you rethrow an exception?
  21. Explain Java inheritance.
  22. Describe the architecture of microservices.
  23. Explain design patterns.
  24. How do microservices communicate?
  25. What is Spring Security?
  26. What is a Spring Bean?
  27. What is the default scope of a Spring Bean?
  28. How does a HashMap work internally?
  29. What will happen if you call hashMap.put(1, 0) and then hashMap.put(1, 100)?
  30. Explain the concepts of Request Body, Response Body, and ResponseEntity in the context of Spring.
  31. Describe the internal working of the HashMap data structure.

Feel free to ask if you have any more questions or need further explanations on any of these topics!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

Up ↑