Panasonic Youth

Java technical interview guide - part 1

update 8/31/05: I have written part two with some possible answers. Also, renamed the post.

I did a technical evaluation for a candidate my employer was looking at awhile ago, so I had an opportunity to try and figure out a good set of technical questions for a prospective intermediate level Java web developer. I’ll just present a whole bunch of questions I came up with - no answers though. I might start up an answers post at a later date, but I don’t want to make this too easy for those trying to fool interviewers. =) Obviously, if you ask every question I have listed here your interview could take hours, so pick and choose what you like. I’d be interested in feedback for ideas on important topics I’ve overlooked or questions that are unfair or unnecessary. I’ve tried to avoid things that can be easily answered with a quick google search, such as basic syntax and API method questions.

Anyways, on to the questions.

General Intro Questions

Just laying the ground work to help lead the way for areas to focus on…

  • Give me a high level description of your experience with the Java platform. What APIs do you have experience with? Servlets? J2EE? Swing?
  • What development methodologies have you used? Which one have you liked the most? The least?
  • What open source frameworks do you have experience with?
  • What other languages have you used?

Object Oriented Principles

  • Define object oriented programming (quite a loaded question...). What are the key OO principles?
  • Describe polymorphism.
  • Describe inheritance ("is-a") and composition ("has-a"). Can you give an example of a use case for each?
  • What is coupling? Why do we want loose coupling in our systems?

Java Basics

Some very fundamental questions I think any “non-beginner” level dev should know. If there are a lot of problems with these it may not be worth continuing.

  • What is the difference between abstract classes and interfaces?
  • Explain the access modifiers in Java.
  • Talk about method overriding and method overloading and their differences.
  • Why does Java have exceptions? What is the difference between checked and unchecked exceptions?
  • What are constructors? Are they inherited?
  • What is the static modifier used for in regards to classes and methods?
  • What are the equals() and hashcode() ? Describe their contracts.
  • When do you use String and when do you use StringBuffer/StringBuilder

Java Intermediate/Advanced

  • Explain the following statement: Java is always pass-by-value.
  • How do you create an immutable type? What are the advantages of immutability?
  • What is a static inner class? Can you provide an example from the Java API?
  • What are the implications of implementing serializable in an object?
  • Why would you declare a private constructor?
  • When do you want to use unchecked exceptions and when do you want to use checked?
  • Can you explain how Strings are "interned" in Java?
  • What are enumerated types? Why would you use them?

Java Collections

  • What are the core interfaces of the Collection framework?
  • How do Vector and HashTable relate to Collections?
  • Desribe typical use cases or examples of common uses for Map, Set, and Lists.
  • What method(s) should override for objects you plan to add to sets or maps?
  • How do you get an immutable collection?

Threading

If a developer works only in the heavily abstracted world of Spring/Hibernate/whatever, they may not have had to touch an actual Runnable since college. Still, its good to know about threading at least on a basic level.

  • What does the synchronized key word do? Where is it valid to use it (ie inside a method call, static block, etc)?
  • Explain the two ways to instantiate threads in Java.
  • What is "double-checked locking"? What design pattern is it typically associated with? What is wrong with it?
  • What is a daemon thread? How do you create one?
  • What method do you use to start a thread?

Servlets and JSPs

  • What are the steps to create a basic servlet?
  • Describe the lifecycle of a basic servlet - for instance, when are they created? What method is called from a typical HTTP request? What about requests and threads?
  • What does it mean to say that HTTP is stateless? How do servlets provide a possible solution to maintain state for web applications?
  • Are JSP's thread safe?
  • What are Listeners? What is a typical use for a StartupListener?
  • What are filters and why would you use them?
  • Describe the four different scopes available with servlets?

Design Patterns

  • What are the three types of design patterns?
  • Can you talk about the history of design patterns?
  • Why use design patterns?
  • What is the role of composition (aggregation) in design patterns?
  • What design patterns do you use often and have the most experience with? Can you talk about a typical use case?
  • Can you provide a description of any of the following patterns? Strategy, State, or Template method?
  • What is Model View Controller, and why would you want to use it? What are some of the disadvantages of it?
  • What is inversion of control, and what does it give you?

Open Ended Questions

These questions are more to just stir discussion and debate and to get a feel for the candidate, rather then to get the “right” answer.

  • How would you build a software version of Monopoly?
  • Can you compare (insert dynamic language of choice here - Ruby/Python/Lisp/etc) to Java? When would you prefer one over the other?
  • What do you think is the most common cause of project failure in the software development business?
  • What do you think of the rise of open source over the last ten years? Where do you see open source in the future?
  • What does agile development mean to you?
  • What is your ideal development environment like? Both in terms of hardware and software, and location and surroundings?
  • What was the last technical book you read? Give me the Cliff Notes version of it.
  • What are some of your favorite resources beyond Google? This could include websites, magazines, technical authors, experts, favorite blogs, etc.
  • Do you have experience with Test Driven Development? If so, what do you think of it?
  • What will be the next language or development topic you want to learn about?