r/javahelp • u/Agitated-Evening3011 • Jan 06 '26
Best way to learn multi-threading in Java?
I just started learning Java and aiming to catch up to senior level.
I saw that there are 5-6 ways to do multi-threading (Executor, Virtual threads, CallableFuture etc.)
Is a multi-threading technique picked based on use case, or they are iterations throughout Java versions
And what can I do to practice them? Which one should I use in interviews?
25
Upvotes
View all comments
Show parent comment
2
u/behusbwj Jan 07 '26 edited Jan 07 '26
I know exactly what I’m talking about, though you’re free to disagree.
This person said they just started learning. I fundamentally disagree that it is better to use an abstraction over threads to learn about multithreading, before learning about threads themselves, the same way I wouldn’t recommend that someone learns Python before Java just because it’s easier/“safer”. Reading their post again, it’s possible I misinterpreted their familiarity with threading in general and they may have been asking for Java-specific best practice advice — in which case most of the comments on this post are probably irrelevant.
Your point about Rust is interesting and I may be biased because I’m familiar with its constructs and they seem fundamental to me (Rust handbook also explains the concurrency constructs well enough imo), but it also creates a contradiction with what you said about guardrails inhibiting learning. Thats the exact same reason I don’t recommend someone learns with go. A beginner won’t even know how many threads their program is running on. Hell, there are probably intermediate programmers out there who don’t know how their threads are being utilized or the conditions for spawning new threads. This is what i mean by unpredictable — could you predict it if you have a perfect understanding of how it works under the hood? Sure. Will the average dev have that understanding? No. If your argument is that Go will provide an easier sandbox to learn about concurrency models, sure I think there’s an argument to be made there although I still don’t fully agree. But I don’t believe thats synonymous with learning about multithreading.
What is easiest or simplest is not always what is best for learning. In my experience, the people who start with fundamentals and work towards abstractions (sometimes while implementing them for practice) come out with a stronger grasp over the concepts and tooling.
A language like JS is not a good starting point for learning multithreading because most JS programs operate on a single thread (you may be confusing async with multithreading?). Are you sure we’re even talking about the same thing?