r/java • • 3d ago

[ Removed by moderator ]

[removed] — view removed post

58 Upvotes

106 comments sorted by

61

u/DarthCaine 3d ago

This day and age I wouldn't ask the same Java techology specific questions as before. I give them code review and system design, no matter the language

27

u/Think-Round-7037 3d ago

I think opinions are really useful. Here’s the kinds of things I like to ask:
- what do you think about the var syntax?
- what do you think are good or bad usages of streams?
- what do you look for in a code review?
- what’s your favourite/worst part of the language?
- what’s your favourite/worst part of spring?
- how do you keep up to date with modern language features?
- how would you explain why you can’t use == to compare strings to a python dev?
- what do you think is the ideal testing pyramid?
-

8

u/rv5742 2d ago

I find these types of questions don't really work for newer devs (2-3 years, in the post). They just don't have enough experience to answer well. A lot of the time, they've simply followed the lead of senior devs in their first job.

3

u/boost2525 2d ago edited 1d ago

Yes, I do interviews and I prefer questions that have no right or wrong answer (like "what's your favorite language feature and why?"). 

Some people, myself included, just don't do well in "test taking" scenarios like leetcode. Give me an open ended question though and I can prove to you how deep my knowledge goes. 

98

u/SleeperAwakened 3d ago

"Which model do you prefer, and why?"

/s

16

u/zerg_zavael 3d ago

Or better: " What's your max daily token consumption?" 😁

4

u/thephotoman 3d ago

Max? I can spend tokens frivolously.

Getting maximum value from your tokens is the real trick. And I’m begging my corporate overlords to invest in some open source models that we can run on an internal server.

20

u/mr_mlk 3d ago

If You Were a Java Interviewer, What Questions Would You Ask a Candidate?

How are you currently using AI?

What questions separate an average Java developer from a strong one?

The "walk me through your thinking" ones.

What tricky questions do you usually ask?

Trick questions? None, they add no value.

Tricky, see above.

What common mistakes do candidates make?

Not asking for clarification. If you get a walk me through/design a thing question, clarify you understanding and ask relevant questions.

4

u/_edd 3d ago

Yep, if the question has a right and a wrong answer and leaves little to no room in between it better take no more than like 30 seconds of the interview.

You don't want to hire someone that studied Java interview questions and answers. You want to hire someone that can reasonably work their way to an answer when something is outside of their current knowledge set.

6

u/mellow186 3d ago

I've found you can filter out many candidates by determining if they understand that variables of class type are references passed by value.

4

u/aoeudhtns 3d ago

Most memorization/knowledge checks are a waste of time. Tech jobs are marked by continuous learning. It's only evidence of time passing. Use questions like that to help size fit for seniority.

How do you learn? What resources do you use?

Walk through design process of a sample system.

How do you keep skills up in our new AI world.

I haven't interviewed anyone in like 8 months though, so I'm not 100% on putting it into practice. I have said to HR that I want in person interviews moving forward because it's too easy to disguise cheating now.

3

u/mencretdimulut 3d ago

i always like someone who can do profiling and debugging, also able to do monitoring.

3

u/cryptos6 3d ago

What is your favorite new Java feature? What does it improve?
or
What do you like and don't like about the language?

This tells whether someone is actually interested and has an idea what's going on. The latter question shows whether someone is aware of trade-offs and has solid experience.

5

u/elmuerte 3d ago

I have never ever asked Java questions.

I try to find out how well the person is in solving problems with limited information. Probe their ability to learn new things. Discover their competency in software engineering principles and concepts. And lastly, what is their personality, we're a team after all.

6

u/_predator_ 3d ago

I don't think I ever asked super Java specific questions. But I only interviewed senior+ candidates so I just assume it as a given that they know their tools.

But if I had to pick one: explain what an Interrupt(edException) is and how you'd handle it.

5

u/Cantor_bcn 3d ago

I’m not saying it’s a bad question, but I think it leaves little room for a detailed answer. If the developer knows the answer, they’ll tell you everything you need to know; if they don’t, they won’t say anything. I prefer questions with several layers, such as volatile or, if you don’t want a top expert, final. Those answers allow you to gauge the person’s knowledge more accurately.

1

u/_predator_ 3d ago

There is plenty of room for a detailed answer. Depending on the candidate's experience, they can take it anywhere from the bare minimum that the question asked for, to how graceful shutdown should behave, including what to do with partial state. Deadlines, checking for interrupts at batch boundaries, propagating the exception depending on where in the code base your code sits etc. - there is loads to talk about.

9

u/Cantor_bcn 3d ago

What is volatile for? I can’t even begin to tell you how many people claim to be Java experts with thousands of certifications, yet are left at a loss for words.

19

u/Ill_Current2911 3d ago

Volatile means that the piece of code is highly explosive and if you invoke it - you could burn your processor

1

u/nekokattt 3d ago

I thought that applied to anything invoking cglib or bytebuddy /j

29

u/bodiam 3d ago

I've been a Java developer for 25 years, and I've never used `volatile`. I can explain what it's for, and sometimes I ask people "what's the difference between transient and volatile", but I don't think knowing what volatile is makes you a better developer or not. But most people who I interview have a hard time explaining what `final` means, which I think is a bigger problem.

10

u/Cantor_bcn 3d ago

I don't understand the question comparing "transient" and "volatile". They're completely different. I mean, they don't even have anything in common.

3

u/Medical-Molasses615 2d ago

I think his point is that for most Java developers in the corp world both are equally unused. 95% of what you need lives in the spring boot ecosystem and the kind of apps you create typically don't have an architecture that requires it i.e. stateless microservices deployed into K8's.

There are a few niche cases where it might be required but your typical Java developer working for a small/medium/corp business doesn't need to know it.

1

u/Skellicious 2d ago

I live in the stateless microservices world and I've had to use volatile like once at best.

Stateless is pretty much the simple default, stateful is where shit gets tricky, you may have to know your concurrency details (but you probably stick to concurrenthashmaps or executor services)

-1

u/revilo-1988 3d ago

Ja hab es auch nur 1 mal eingebaut die letzten 18 Jahre wo es sinnvoll war

5

u/Ok_Cancel_7891 3d ago

what percentage of (senior) Java devs know well multithreading?

3

u/Alarmed-Tell1315 3d ago

On top of that, what real cases require managing threads by hand? most real production-grade implementations rely on Spring TaskExecutor or RXJava that really doesn’t require detailed understanding of threads.

3

u/MagicalPizza21 2d ago

Most multithreading I've done as a real developer has been using work stealing or the executor service.

1

u/Ok_Cancel_7891 3d ago

I made my own search engine, and for crawler, I needed to make an engine with my own working threads

2

u/BanaTibor 3d ago

One in a lifetime project.

1

u/Ok_Cancel_7891 3d ago

Several years it took me to make it work as intended

1

u/BanaTibor 2d ago

As I said one in a lifetime.

1

u/TenYearsOfLurking 2d ago

You need to understand the primitives of concurrency. Locks, monitors, latches, volatile. At the very least on the database level because concurrency is everywhere in real production grade apps

1

u/Alarmed-Tell1315 14h ago

I write my code mostly in Kotlin this days… co-runtimes have the same function than threads and archive functionally the same with no understanding of threads in vanilla JDK.

Knowing them is valuable, never indispensable.

1

u/TenYearsOfLurking 14h ago

I guess you are somewhat right. But with every high level abstraction - there will be a point where you wonder what is going on and it helps to know the low level details.

That aside, imho database concurrency is an absolute must, you need to know optimistic, pessimistic locking etc. Because in my experience you can often push concurrency handling "down" to avoid having to deal with in-java concurrency (at least in your average business app) and I am still amazed how many "seniors" have no clue at all.

So to get back to the point: I can totally see how a jvm developer does not need to know what volatile actually does but you must at least know other mechanisms, abstractions really well.

1

u/Alarmed-Tell1315 14h ago

There is an important distinction between knowing what volatile does internally and understanding the Java Memory Model. A developer might reasonably never need to implement low-level synchronization, but they cannot safely ignore the guarantees and limitations of the abstractions they use. But, I agree with you - low level understanding is always better than shallow understanding. I think the discussion has devolved into an unidimensional argument of what a good developer needs to know based on his/her understanding of threads.

0

u/Cantor_bcn 3d ago

It depends on what they’re working on, but very few.

0

u/EthanEvenig 3d ago

Immaterial. I'd only hire one who does.

1

u/Alarmed-Tell1315 14h ago

Interviews that serve to boost the interviewer ego, I’ve seen those. They miss on really talented people that actually have talents that will be useful and not obscure understanding of things that will never be used in practice. Expert in threads that will write Spring boot apps 🫠

20

u/Prior-Equal2657 3d ago

And for what? It's useless 99% of time.

7

u/stubbornKratos 3d ago

It’s important that experienced software engineers can reason about concurrency. In the context of Java, knowing about the JMM and volatile is a fair ask for a lot of jobs.

8

u/brian_goetz 3d ago

Just because something is "useless" (I don't think you actually know what that word means) doesn't mean you get to pretend it doesn't exist.

Most people don't have heart attacks or strokes very often, but knowing the warning signs might be the difference between living and dying. Even though they are "useless" 99.999% of the time.

4

u/Cantor_bcn 3d ago

OMG, I have your book! It's right next to Effective Java.

-1

u/Prior-Equal2657 2d ago edited 2d ago

You see, that's the problem.

You say 'volatile' is important to understand, and meanwhile python is #1 language by usage which till 3.14 was effectively single-threaded because of GIL.

In a typical corporate daily work using volatile is a super-edge-case.

0

u/Cantor_bcn 2d ago

Python and Java have different areas of application. The fact that Python did not support multithreading when it first appeared is irrelevant. If there is one area where Java is particularly powerful, it is in the ease of multithreading.

In a typical corporate daily work there are batch processes, and these are highly susceptible to improvement through multithreading. It's not a super-edge-case

-1

u/Prior-Equal2657 2d ago edited 2d ago

Thanks. I know. I'm speaking about language popularity.

The more popular language is, the faster it develops, the bigger ecosystem is, etc.

Moreover, python's 'application' is just java's missed opportunity. That's it. What python has to offer that java doesn't?

3

u/Scf37 3d ago

remaining 1% is enough to introduce bugs you will investigate 99% of the time.

1

u/radikalkarrot 3d ago

I use it quite often, what are you on about?

4

u/Scf37 3d ago

Indeed. Simple question, hard to answer, especially when asking not to quote JMM but explain in practice how will volatile vs non-volatile field behave.

8

u/rlrutherford 3d ago

Maybe because they write stateless code and don't need it?

1

u/Cantor_bcn 3d ago

A Java expert who only writes stateless code and has never needed concurrency? Well, I don’t know what he’s an expert in, but it certainly isn’t Java.

3

u/Medical-Molasses615 2d ago

That is 99% of what is written in the typical corpo world these days though. Spring boot based microservices deployed into k8's or similar. If you have a team of developers it literally doesn't matter.

1

u/TenYearsOfLurking 2d ago

These people don't know shit about concurrency in general and it shows. Because guess what? State is somewhere, as your cool stateless app talks to a database.

If you know how concurrency works you can avoid r-then-w problems, etc. Java level or db level. This is a must if you call yourself senior.

6

u/sweating_teflon 3d ago

It's for LLMs to try and impress you by writing shit code when they should just use synchronized or Atomics instead.

0

u/Cantor_bcn 3d ago

Well, ‘atomic’ is acceptable, but you should have stopped there.

2

u/sweating_teflon 2d ago

What's wrong with synchronized? 

1

u/Cantor_bcn 2d ago

There’s nothing wrong with synchronized; the problem is using it as a substitute for volatile.

2

u/washtubs 3d ago

I mean it's something people are able to avoid completely with ReentrantLock so I don't think it's a huge deal to not know that specifically. I think you'd be better served describing race condition program behavior and seeing (a) that they can label that a race condition and (b) that they can offer a solution.

2

u/Cantor_bcn 3d ago

I don’t agree. This is like a comment further down that says it can be replaced with synchronized; I’d say that ReentrantLock isn’t all that bad, but you wouldn’t use it where volatile is sufficient. Besides, if someone is familiar with ReentrantLock, they should know about volatile.

1

u/washtubs 2d ago

but you wouldn’t use it where volatile is sufficient

If both are sufficient, why not? I prefer explicit mutex handling by default. It makes it very hard for someone to read the code without noticing the thread safety concerns. And often if one field is volatile it's not uncommon that another needs to be as well. The lock is more efficient in that case because one dedicated mutex can cover reads and writes to both.

My point is you can know everything there is about concurrency in general it is still very possible to just not remember what volatile means. So it's much better to assess concepts.

1

u/Cantor_bcn 2d ago

Because if I’m using multithreading, it’s because I’m trying to optimize performance, and if volatile is enough, its performance will be much better than ReentrantLock. Why would I choose something slower?

1

u/-Nyarlabrotep- 2d ago

It means holiatile, It's a hint for the rutime.

2

u/parnmatt 3d ago

Using the debugger to help figure out where an issue is during a live coding section can not be understated. Same with sharing your thought process out allowed.

The number of interviews where a candidate is almost silent and just staring at code isn't helping me evaluate you.

I do try and ask what they're thinking, or to remind them they have tests they can try, or I might even suggest "putting a break point there, and let's see what's going on". But the candidates that gravitate to that before being hinted to …chefs kiss.

Of course, read the room. If it's a little more like a pairing session, then they are also evaluating how you work with others and see how you think. Even if you way of thinking is different than there's, that's ok, it'll be how you navigate that and how receptive you are to different approaches. So speak up, ask questions, ask opinions.

If it's more old school leet code problems on a whiteboard… I'm sorry. Power through it. Still best to speak up and confirm any additional or varying conditions.

2

u/Paw565 3d ago

Do you hate hibernate and why yes 😅

3

u/Dependent-Net6461 3d ago

You all should live in incredible places. Candidates i usually find in interviews can barely explain differences between inheritance and composition..

3

u/viktorzub 3d ago

Ci/cd , monitoring, failed chooses etc

2

u/vintage_si 3d ago

Not necessarily a Java centric question, but
a typical icebreaker question I would typically ask, which libraries, APIs do you find interesting or enjoy using? It can lead to some interesting discussions and tends to ease into the interview.

2

u/cinlung 3d ago

I usually opens the interview with telling them to make the logic of printing stars

**********

*********

********

*******

******

*****

****

***

**

*

Only with pen and paper. If they pass this, I will ask another. Yes, many candidate I met failed.

8

u/SleeperAwakened 3d ago

Bonus points for doing it without a loop and 10 print statements.

6

u/ddollarsign 3d ago

I can do it in one print statement.

1

u/EnricoLUccellatore 3d ago

how would you do it without a loop?

0

u/TenYearsOfLurking 2d ago

If a single statement is the requirement of this task (let's pretend) - a stream with foreach at the end would do the trick 

3

u/slindenau 2d ago

Calling a stream with multiple chained method invocations a "single statement" is equivalent to saying you wrote a "single line" because you didn't add newlines after your semicolons. Technically true, but not true to the intent of the question/limitation.

1

u/HSSonne 3d ago

I would swift the main topic to communication skills.

1

u/josephottinger 3d ago

I would be happy that you're interested in the concepts you've listed - although I'd not care about java 8. Java 17 is as far back as I'd go, so mentioning "java 8" feels like someone mentioning their interest in ISPF. :D

But what I'd be looking for in a strong developer for ANY language wouldn't be any of those things. My tricky questions would be around what you laugh about, what annoys you, how do you learn, how do you teach.

The mistakes candidates make with me are in refusing to try to get along. Someone who's upset that a discussion doesn't count L2 cache into account for simple tasks... I mean, I'm impressed if you know about that, I guess, that's definitely a thing, but if you can't accomodate people, if you're a jerk in an interview, if you can't teach, if you can't learn, if your pride gets in the way of working... then we're cool, I'll appreciate the time you took, but you're not passing my interview.

I can fix technical concerns. I can't fix someone's psychology, and a genius at code who wrecks the teams he works with is a net negative.

1

u/raxel42 3d ago

What is the main synchronization primitive that everything is built on?
How to combine two optional values (not methods, but ways; open question).
How to terminate the future?
And what's interesting: after 10 years writing Scala and 10 years writing Java before, you can generate questions based on your Scala experience, and you know how to exploit Java in very different ways.

1

u/munchillax 3d ago

i'd rather evaluate them on how well they work with coding agents these days.

1

u/ishysredditusername 3d ago

90% of the people I interview have already forgot how to write a unit test with mockito.

Depends what the salary is. For a midweight id be expecting you to be able to explain how to test different things and how to structure something so it was able to be tested and documented.

I’d ask you about secure coding practices, I’d give you a scenario and ask how you’d debug something.

How you do a code review, how you would do a 10k line change code review (send it back and tell them to do one).

Get on bealdung and make sure you can nail the basics. If they ask you to write a test and you can’t remember how to pass a stub in, it’s not a good look.

1

u/quarentlne 3d ago

Ive never got questions related to java, only about my expererience

1

u/Sensitive-Door-7939 2d ago

I'd give them a problem statement to talk on 10 mins prior or may be lesser time , give them pen paper to jot down and prepare notes, similar to how ielts speaking works where you get 2 mins to jot down thoughts and then you speak on it, keep the topic relevant around what the candidates are expected to prepare around for these system design interviews, be as thorough with requirements as possible because we need to be very thorough with explaining the requirements and listen to it. Seriously half of those Uber YouTube design interviewers themselves have mugged up the requirements and working. Ask the same interviewers to design CS GO and they will fail because they don't know how game servers work.

Hence better to see common points in general softwares that your projects need and are common outside of your industry hence the problem statement needs refining.

Target should be the thought process analysis, communication of what problem they understood, what they are thinking are possible solutions, give them hints or ask them what all they know around the answer you want to listen to or see why they discredit your version of the answer because no single design is correct answer.

1

u/__konrad 2d ago

I would ask what it prints, why method args are ignored, and why println order affects reflection ;)

static void r(String s, int i) throws Exception {
	class C {
		C() {
			IO.println(i + " " + s);
		}
	}

	C.class.getDeclaredConstructor(String.class, int.class)
		.newInstance("BAR", 2);
}

void main() throws Exception {
	r("FOO", 1);
}

1

u/SleepingTabby 2d ago

A "gotcha" that the proverbial 99% will only able to answer correctly if they had to deal with it in the past :)))

1

u/radio-nl 3d ago

“Why the heck don’t you write in Go??”

1

u/BullfrogCharming1202 3d ago

I would much rather they do some programming than answer questions about programming.

1

u/ddollarsign 3d ago

Walk me through your resume or recent work history. Tell me about a project you worked on. How would you handle x problem? What are you like as a coworker?

0

u/audioen 3d ago edited 3d ago

Probably I need to know how good you are recognizing what is minimal and elegant, and also how good you are at top-down problem solving, like how you break down problems and how you approach their solutions. I would want you to have drive for minimalism and eye for good architecture and ability to trace the consequences.

What I don't need is, frankly, a developer. Knowing the minutiae of Java is less important than ever because of LLMs. I know my may seem like I'm taking the piss with your question, but world changed in 2026 and I think it's sensible to adapt to new reality. Knowing how to write Java and use its frameworks is just nice to have but it's now a less important item. This is also, by my estimation, the permanent situation: today, LLMs are cheap and fast enough even locally. You can run good enough AI systems as soon as you have about 128 GB of memory. I do not speak of any big cloud models when I say this. I run these on computers I own, which are nothing special. The only thing special about them is that they all have at least 128 GB of RAM.

To be honest, LLM can be just told to do minimal, elegant solutions as criteria it should observe, and to produce high level plan which you iterate down to higher detail. It's pretty much already capable of doing the whole thing. But I still think that at least in 2026, uncritical acceptance of LLM in everything would be a problem, and that the cybernetic organism of man and machine together can produce superior solution. I would want my candidate to understand the business domain they want to write programs in, research approaches to be taken together with LLMs, produce sensible first drafts with aid of LLM, and look it through critically for any problems that could be foreseen, but then generally get their hands off from the implementation, testing and reviewing loop. That part is nearly certain to be machine done by this time in 2027 in most workplaces. All that stuff you are preparing for is for the old world which mostly doesn't exist anymore. At most, it is a proxy for "generally smart person", maybe. Do you see what I'm getting at? It's just not particularly interesting anymore.

-1

u/blue__rabbit 3d ago

How will you construct prompt to solve given problem

-1

u/pradeepngupta 3d ago

In this age of AI, I will not see if the candidate can write Java Program. Infact, I will focus on the problem solving attitude + whether the candidate can review the code generated by AI in the sense of solving problem accurately.

0

u/White_C4 2d ago

Replace Optional from Java 8+ features since it's so niche even the Java standard library barely uses it. It'd be more useful asking about interface, pattern matching, sealed, and record. You can know a lot more about a software engineer based on their ability to answer and apply these features into the codebase.

Anyone who can't justify why interface has some advantages over inheritance should not be considered for the job.

-5

u/hadrabap 3d ago

Why you didn't switch to Kotlin already? /s

4

u/SleeperAwakened 3d ago

Good interview question though, nice area for discussions. Even if you dislike Kotlin or have good reasons to not use it.

7

u/_predator_ 3d ago

What do you like / dislike about $language is a good casual question to ask in between so it doesn't get too tense.

1

u/pohart 3d ago

I like this one because I want a candidate that has thought about the tools they use. I don't care if they answer it for Java or c# or c or php. 

5

u/rlrutherford 3d ago

Because Scala did so well.

-7

u/frinkmahii 3d ago

Give them Claude code or similar. Then a challenging issue.

Watch the prompts and the thinking and ask questions in the results.

Watch the process and evaluate their thinking and competency on checking the LLM result.

That’s what you need to hire for. Not esoteric issues.

5

u/nekokattt 3d ago edited 3d ago

kinda hard to judge actual understanding from vague prompting. What do they do when they actually need to dig through the code themselves and do not know what they are doing?

I can tell you what ruby looks like, i know all the language agnostic programming concepts that you would be using in a role performing ruby, and I can write prompts... but I have no experience working with Ruby myself. Do you consider me a Ruby engineer just because I can get by with prompting?

How are you going to verify things like when the agent hallucinates a thread safety bug in code it has generated, or a resource leak and the developer lacks enough hands on experience to identify that?

-4

u/martinhaeusler 3d ago

I always ask how to get a value of a private field from a class you do not own (i.e. a library class). Most candidates start sweating at that point because the average Java developer can't write reflection code.

3

u/Cantor_bcn 3d ago

I’m sorry, but private is private for a reason; accessing the variable via reflection is a poor decision. 

0

u/slindenau 2d ago

This person knows at least 11 ways to get access to java privates. Would you say they are a good or bad developer for knowing this?

https://wouter.coekaerts.be/2026/decapsulation

Note that there is a difference between knowing and using in production...
Knowing some feature exists and when NOT to use it might be more important than knowing the feature itself.

1

u/Cantor_bcn 2d ago

I’d say that’s bad programming practice. Why on earth would I ask a candidate if they know how to write bad code? Do you ask someone if they’re capable of writing spaghetti code?

1

u/ninja8750 3d ago

Why to access private fields from library which we do not own if there is no public getter for that field isn't it looks like trespassing.

3

u/martinhaeusler 3d ago

If a candidate can explain why it's a bad idea to do so, that's also noteworthy. But the question remains: can you do it? Turns out, most people can't.

2

u/ddollarsign 3d ago

I would ask google how to do it tbh

0

u/bodiam 3d ago

"ask nicely"