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

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.