DEV Community

60 Java and Spring Interview Questions You Must Know

Alex 👨🏼‍💻FullStack.Cafe on April 17, 2019

A good Java and Spring developer is aways in demand. According to Indeed, there’s currently 29,694 job openings for Java developers and 16,085 for...
Collapse
 
osklyar profile image
Oleg Sklyar

A set of questions to test how well a candidate memorises random, mostly irrelevant stuff.

If you are an interviewer, no matter at which level of your or candidate seniority, do not ask Spring questions even in a Java interview. Do not ask trivia questions on any programming language either. Both yield exactly zero signal about general cognitive ability of a candidate.

And if you are a candidate being asked a lot of this stuff: do you want to be a builder putting up brick walls (as this is what the company really expects when they expect you to know or remember most of this stuff) or do you want to be an engineer and of relevance beyond this immediate job opportunity?

Collapse
 
jmfayard profile image
Jean-Michel 🕵🏻‍♂️ Fayard • Edited

I think you are overthinking this.

"60 questions THAT YOU MUST KNOW"

Is MUST here used in the sense of a RTC?
If you were a boss, youldn't you give the job to someone smart and able to get things done, but score only 29/60 on your list of thins that HE MUST KNOW?

You can do the job correctly without knowing any of this at first.

If you can do the job, them there are companies happy to have you.

I will play the Evil advocate here and give you the counter-argument for hiring someone who doesn't know all of this.


Q1: What is the Difference between JDK and JRE?
some people are bad at acroynms and good developers

Q2: What is the difference between an Applet and a Java Application?
if you don't know what an Applet is, it just means that you are not old

Q3: What is a JSP Page?
Q3: You can be a Spring dev and not care about JSP

Q4: What is a Servlet?
Q4: Can be trivially found in the JavaDoc

Q5: What are pass by reference and pass by value?
Q5: If a dev doesn't know this, 30s a training can fix the problem

Q6: What are the basic interfaces of Java Collections Framework?
Q6: Not a red flag. Could be that I'm hiring a good C# backend developer that wants to learn Java

Q7: What differences exist between HashMap and Hashtable?
Q7: I didn't know this but I'm a good developer

Q8: What does System.gc() and Runtime.gc() methods do?
Q8: Can be trivially searched in the Javadoc

Q9: What is the difference between Exception and Error in java?
Q9: I javadoc this all the time, can't remember for reasons, not a problem

Q10: What is an Java Applet?

Q10: I know what a Java Applet only because I'M old
Q11: Can be found in 10s in Google
Q12: Can be learned real fast, not an issue.
Q13: Just a vocabulary question, not an issue.
Q14: Someone smart can visit the Spring homepage and figure this out.
Q15: Just a vocabulary question
Q16: Easy to Google
Q17: I didn't know this when I started doing Spring development
Q18: Javadoc
Q19: Can be learned with Wikipedia quickly
Q20: Can be learned with Wikipedia quickly
Q21: If someone fails at this, it's probably for a vocabulary question more than anything
Q22: A good backend developer that knows another programming language will learn this like really fast
Q23: tutorial "java how to create a thread"
Q24: important programming concept, but who knows all of them? Not me
Q25: important programming concept, but who knows all of them? Not me
Q26: easy to javadoc
Q27: again it's fine if a C# dev has to learn this
on the job
Q28: important programming concept, but who kmows them all? not me
Q29: Not really useful if you don't do Java applets
Q30: I had no idea and that was fine
Q31: Well I can hire a dev that can't answer this
Q32: A dev could know this perfectly what SOLID means and try to apply everwhere where it doesn't make sense, that would be a bad dev
Q33: Those principles are sometimes true, sometimes wrong
Q34: The right answer is it depends
Q35: Javadoc
Q36: Can be learned
Q37: You can build lots of stuff without Aspect
Q38: Javadoc
Q39: Google is your friend
Q40: Javadoc
Q41: Javadoc
Q42: Javadoc
Q42: Javadoc
Q43: Javadoc
Q44: Important programming concept, but who knows them all? Not me
Q45: I didn't know this and was hired anyway
Q46: You can build good software without RMI
Q47: Important programming concept, but who knows them all?
Q48: The Android team didnt avoid GOD classes and they were super successfull
Q49: Javadoc
Q50: You can build software without weaving
Q51: You can build software without AOP
Q52: Important programming concept etc
Q53: You can build software etc
Q54: I didn't know what WebFlux was when I started
Q55: Trivia question
Q56: Most good devs don't know this and that's fine
Q57: I don't think your boss cares about RMI
Q58: Important programming concept etc...
Q59: Best practices are often wrong
Q60: The important thing is to use autowiring as little as possible

Collapse
 
michelemauro profile image
michelemauro

You'll be surprised how many candidates, even some that later refused a proposal on the economics, couldn't correctly answer "#1: What is the Difference between JDK and JRE?". It's been very depressing to watch, interview after interview.

Collapse
 
shostarsson profile image
Rémi Lavedrine

That is an interesting article.
I am planning to do something similar about Security. So I see what could be a good way to start.

Collapse
 
gossie profile image
André Schreck

There are some really interesting questions.
Concerning Q34 I would add a third option, which in my opinion is the best one. Returning an empty java.util.Optional. That way the API implies that the result might be empty and there is no risk of a NullPointerException.