Skip to main content

Any good interview questions to ask prospective Junior java developers? [closed]



Does anyone have a good interview question to ask prospective junior java developers? They will have a two year minimum experience requirement. The questions will be on a written test and they will have five to ten minutes to answer each question.





Limit to one interview question per response for voting purposes please.


Comments

  1. Compare and contrast (don't you love that phrase?) the modifiers public, private, protected and default.

    Compare an interface to an abstract class and give an example of when you might use one of each.

    What does the modifier final mean to a class and a variable?

    What is overloading and why might you use it?

    What is garbage collection and how does it work in java?

    How do you make a Thread in java?

    Write a generic main method and explain what each item in the method signature means.

    Explain how try/catch/throw/finally work.

    What is an Iterator and how do you use it?

    What are generics?

    Are these lines of code valid and describe why or why not:

    List<Object> myList = new ArrayList<String>(); \\(hint: no)
    Map<Integer> myMap = new HashMap<int>(); \\ (hint: also no)

    ReplyDelete
  2. Avoid you-know-it-or-you-don't questions about the Java API. These are worthless, IMO. My favourites are questions that ask for value judgements, because they allow good candidates to show their insight without necessarily having to have gained familiarity with particular parts of the API (which is what Javadoc is for, after all...)

    My favoured technical question is to get the interviewee to implement the equals method for a simple class with a couple of fields, and in the case of a face-to-face interview to defend their implementation (which will pretty much always be non-optimal or missing something).

    Other questions I'd consider at least sprinkling into the list would include things like: "What feature would you most like to see added to Java?", "How would you go about debugging a NullPointerException?", "In a twenty-lecture training course on Java, in which lecture should the concept of object orientation be introduced, and why?", "How does Java differ from other programming languages you've worked with?", and general language-agnostic questions like "Why are patterns a good thing?", "Should good code be self-documenting, or is it the responsibility of the developer to document it?", and the suchlike. Mostly I'm not looking for a right answer as such with a lot of these questions. I'm looking for an understanding of the question, a coherent chain of thought behind it, the ability of the interviewee to defend their viewpoint, and the ability to go beyond the simple multiple choice API questions that got them their JCP qualification that's no doubt taking pride of place on their CV.

    They can learn the parameters to String#regionMatches later, or just let their IDE provide the list every time for all I care.

    ReplyDelete
  3. You attempt to run a bunch of compiled Java code that someone else gave you, and you see the following near the start of a stack trace:

    NoClassDefFoundError: org.apache.commons.lang.StringUtils.

    What went wrong? How can you fix it?

    ReplyDelete
  4. Have them write code!

    Fizzbuzz is a good quick test...
    http://www.geekschool.org/programming/fizzbuzz/

    ReplyDelete
  5. Ask them to do OOAD of a given system description in 10 minutes. Observe how they tackle the problem.

    ReplyDelete
  6. Write some Java code with obvious errors. Inside the code you place
    innocently a '==' comparison of objects instead the correct '.equals()'.
    (Be sure that the compared objects in memory are different and the
    code fails, else the candidate may claim optimization).

    If you haven't programmed in Java a while (especially if you come
    from C/C++ !) you simply don't see the error ! It is a warning sign
    if someone claims long experience and can't detect this error because
    it is a real pain in the ass when you learn Java.

    ReplyDelete
  7. Ask what is the difference between an ArrayList and a Vector, a HashMap and a HashSet.

    ReplyDelete
  8. I believe that more important than pure technical knowledge is the ability to communicate complex technical issues to someone who doesn't have a technical background. It's much, much easier to teach specific programming skills to someone who communicates very well than to teach communication to a pure techie.

    To that end, my favorite question is: "Pretend that I am your grandmother (or other non-technical person). Explain to me what it means for a program to be object oriented."

    Remember--this is all about communication. Ask your technical questions too, but teaching communication is much more difficult than teaching programming.

    ReplyDelete
  9. Ask when will the finally block not get called?

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex