EDIT: Thanks guys for the feedback, this was very helpful. Clearly, I need to do some reading on effective interviewing strategies and I think I will adopt a more conversational rather than inquistorial style.
I wanted to make sure I asked in-depth questions that would demonstrated in-depth knowledge about what we need from a developer and the points I saw on the guy's resume (Java, Java EE, Spring, OOP, Hibernate, etc.). I had more questions in each section, but I had to skip past stuff because I wasn't getting answers I liked out of the guy.
Do you guys think these were reasonable questions to ask in an interview? I was really more interested in the candidates reasoning than knowing exact answers. This was a phone intervew. The guy gave me good "book" answers (sometimes seemed like he was reading from a book, hmm). But when I started asking "why?", he couldn't give good answers.
Some basic platform stuff:
-
List three Collections interfaces and the basic contract of each. List concrete implementations of each, how they differ, and performance characteristics in space and time.
-
Describe the contract of equals and hashCode. Why is it important that if you implement one, that you implement both?
-
What are generics? What is type erasure and what are the consequences? What are variance, covariance and contravariance? If blank stare: why can't you assign a collection with a generic type binding of a sub type to a reference to the same collection type binding of the super type? How do you specify the type binding of the super type to allow this? How do you specify the type binding to allow type-safe insertion?
Concurrency
-
Explain how notify and notifyAll work, and the difference between the two. Why prefer notifyAll to notify?
-
What is a deadlock and how do you avoid it?
-
What is a race condition and how do you avoid it?
-
What are some of the high-level concurrency classes provided by java.util.concurrent and how do they work?
Database
-
What are the different statement types and why would you use each?
-
How do you prevent SQL injection attacks?
-
What are transactions? What is ACID?
Hibernate
-
Give an overview of Hibernate and ORM. How do you load objects into the session? What does the session do with the objects while in the session? What is the difference between getting a persistent object from the session and querying for persistent objects?
-
When is it better to use plain SQL instead of ORM?
Java EE
-
How do you configure a DataSource in Weblogic to make it available using JNDI?
-
What are some ways for the client to obtain a reference to the DataSource from the app server? (Spring is not the answer I am looking for)
Spring
-
Give an overview of how Spring Dependency Injection container works. What is the purpose of DI? How to specify bean definitions? What are the different scopes? When do beans of each scope type get instantiated?
Web Services
-
What is the difference between SOAP-based web services and REST-based web services?
-
Describe SOAP and WSDL.
-
What exactly is REST? What is HATEOAS? What is the purpose of each of the HTTP verbs? What is idempotence? What is content-negotiation?
OOP
-
What is decoupling? Why are loose-coupling coupled classes desirable? What are some drawbacks?
-
What is cohesion? Why are highly cohesive classes desirable? What are some drawbacks?
-
Describe polymorphism. What is the importance of contracts between interfaces and concrete types? Why is polymorphic code desirable? What are some drawbacks?
Java interview questions
115 Java Interview Questions and Answers – The ULTIMATE List
140 Java Interview Questions Answers for 2 to 5 Years Experienced Programmers
100 most asked Java Interview Questions and Answers
Are Java 8 features frequently asked in 2-3 years experience Java interviews?
What Java topics should I focus on for 2-3 years experience interview?
What types of questions are asked in Java senior developer interviews?
How do you prevent memory leaks in Java?
Explain concurrency handling in your last project.
How would you implement a thread-safe cache?
What are the trade-offs between using Streams and traditional for-loops?
What GC strategies have you used in production?
Videos
Someone on linkedin posted the following questions he saw on an interview:
-
What are virtual threads in Java 21 and how do they differ from traditional threads?
-
How does record improve DTO handling in Java?
-
Explain the difference between Optional.get(), orElse(), and orElseThrow().
-
How does ConcurrentHashMap achieve thread safety internally?
-
What are switch expressions and how are they different from switch statements?
-
Explain the Fork/Join framework and its advantages.
-
How does pattern matching for instanceof simplify Java code?
-
How do you implement immutability in Java classes?
-
What are the benefits of using streams and functional programming in Java?
-
How does Java handle memory management for unreachable objects?
I've been a developer for over 10 years, mostly backend java, and I can only answer 7, 8, and 10. Am I right in thinking that these types of questions don't accurately gauge a developer's ability, or am I just a mediocre developer? Should I bother learning the answers to these questions (and researching other java interview questions)? On the one hand I don't think it would make me a better developer, but maybe this is what it takes to pass interviews? In previous interviews (I haven't interviewed since pre-covid) the technical part of an interview would just involve solving some problem on the white board.