In this second iteration of our Java interview questions, I have pulled some other commonly asked questions from the following website:

  1. What is the difference between HashMap and HashTable?
  2. What is the difference between Vector and ArrayList?
  3. What is the difference between a constructor and a method?
  4. What is an Iterator?
  5. Do I need to import java.lang package any time? Why ?
  6. Does importing a package via the * operator also import all the subpackages? For example, does importing* also import*?
  7. What are wrapper classes?
  8. How are this() and super() used with constructors?
  9. Is it safe to use an instance variable inside of a singleton class?

Bonus Content

One extra piece of advice that I would like to give that I didn't mention in the podcast recording is how to act during the interview. If you are asked a question, and you don't know the answer off the top of your head and just need time to think about it, then say so! Don't be afraid to say “That's an excellent question, I'm pretty sure I know the answer but just give me a moment to think about it”. And then proceed to THINK about it in complete silence.

I've been in interview situations before and have had to do this myself. It feels a bit awkward sitting in silence, but believe it or not (as having been someone on the other side of the table), it's not a huge pain in the butt as an interviewer. With the silence, it gives the interviewer time to do things like:

  • Review your resume further and think up more questions
  • Review your previous answers to ensure nothing was missed
  • Or just sit back and relax

So by all means, take the time to think things through and don't just blurt out the first thing that comes to mind. If you blurt out the incorrect answer without thinking, then you will not stand out as a strong candidate to be hired. So collect your thoughts and take the time to think your answers through first!

Free Java Beginners Course

Start learning how to code today with our free beginners course. Learn more.