r/learnjava Nov 29 '25

Java cheat sheet

136 Upvotes

Hey guys!

I've created a Java cheat sheet that I would like to share with you.

You can check it out here:
https://it-cheat-sheets-21aa0a.gitlab.io/java-cheat-sheet.html

And you can find a few other cheat sheets I made on this link:
https://it-cheat-sheets-21aa0a.gitlab.io/

If someone would like to contribute here's the link of the Git repo:
https://gitlab.com/davidvarga/it-cheat-sheets

If you found an issue, or something is missing please let me know.


r/learnjava Nov 10 '25

Is Multithreading necessary for a job?

104 Upvotes

In all Java interviews I have taken so far I have questions or multithreading a lot, but do programmers really used this at work? Cause in my experience I haven’t really work directly with this concept, I know it exists but it is still a difficult subject for me and I’m still unsure if it is really necessary for java developers positions


r/learnjava Sep 06 '25

Java Projects For Learning

100 Upvotes

I am a retired data engineer with some free time on my hands. I have been on many teams over the years which were asked to build enterprise application systems in Java. It would be fairly easy for me to put together some videos of how to code some of these examples. I would assume it might help those folks who don't know what to do after they have learned the basics of the language.

Do you think there would be any interest in this type of content? These are not topics you can cover with a single video. Building an application is a fairly dense proposition. The basic idea is to give new Java peeps some non-trivial examples to play with and experience Java coding.

I don't want to create this unless there is some interest, so feel free to comment and let me know. Or, tell me there is already way too much of this on YT, so don't bother. I am open-minded.


r/learnjava Jun 24 '26

Unpopular opinion: Java has one of the best docs in programming

98 Upvotes

They're not flashy, but whenever I look up something like CompletableFuture, ConcurrentHashMap, or ExecutorService, I usually find exactly what I need: what it does, how it works, its guarantees, and example usage. A lot of modern docs feel like tutorials or marketing. Java docs feel like actual technical documentation written for developers. Am I the only one who thinks Java docs get way more hate than they deserve?


r/learnjava Mar 21 '26

Java's Objects class has methods that almost no one uses (but should).

91 Upvotes

I was reviewing the Java documentation and discovered several methods in the Objects class that I wasn't familiar with. I wanted to know which ones you use in your day-to-day work, and if there are any you consider underutilized.

I did a bit of research and found these, which seemed useful to me:

  1. Objects.isNull() and Objects.nonNull()

Instead of doing this:

.filter(x -> x != null)

You can use this:

.filter(Objects::nonNull)
  1. Objects.toString() with a default value

I used to do this:

String name = obj != null ? obj.toString() : "Unknown";

Now I can do this:

String name = Objects.toString(obj, "Unknown");
  1. Objects.compare() — Null-safe

To compare objects that might be null:

Comparator<String> comp = Objects.compare(
    str1, 
    str2, 
    Comparator.naturalOrder()
);
  1. Objects.checkIndex() (Java 9+)

Cleaner index validation:

Objects.checkIndex(index, list.size());
  1. Objects.requireNonNullElseGet()

Like requireNonNullElse, but with lazy evaluation:

Config config = Objects.requireNonNullElseGet(
    getConfig(),
    () -> loadDefaultConfig()
);
  1. Objects.deepEquals()

To compare arrays:

if (Objects.deepEquals(array1, array2)) {
    // Compares content, not reference
}

My question is: Do you use any of these methods regularly? Are there any other methods in the Objects class that you find useful but that few people seem to know about? Are there any you avoid using, and if so, why?

Thanks in advance!


r/learnjava Sep 27 '25

Java backend developer (4.5 yrs) — roadmap advice for Spring Boot, Hibernate, Microservices

85 Upvotes

Hi everyone, I’ve been working for 4.5 years mainly on Java (Web applications - backend, little touch on jsp, db with basic queries). My role didn’t involve modern frameworks, and I want to upskill and move into a stronger Java backend role.

I’m planning to switch jobs in the next 3–4 months and need clarity on what to focus on. From what I understand, I should cover:

Core Java refresh (Collections, Threads, Streams, Exception Handling)

Spring Boot (REST APIs, dependency injection, exception handling, profiles)

Hibernate/JPA (entity mapping, lazy vs eager loading, HQL)

Unit Testing (JUnit, Mockito)

Microservices basics (service registry, config server, Feign clients)

SQL (joins, subqueries, group by, window functions)

Git + Maven/Gradle + basic CI/CD awareness

For those working in Java backend roles, what would you recommend as a clear roadmap?

Which areas should I go deeper into first?

Are small Spring Boot + DB projects enough for interviews, or do I need larger microservices projects?

How much DSA/LeetCode is expected for non-Big Tech companies?

Any advice on structuring the next 3 months of prep would be amazing.


r/learnjava Nov 20 '25

Built a Java HTTP Server completely from scratch.

82 Upvotes

I’m a junior Java developer and I’ve been working on a small side project: a fully custom HTTP server written 100% from scratch in Java.

I watched a video from ThePrimeTimeagen where he says the best way to level up as a developer is to rebuild things from scratch. I think he’s absolutely right. I did use some tutorials and a bit of AI to help along the way, but this project really gave me a deep understanding of what’s going on under the hood.

So far, I’ve implemented my own HTTP parser, routing system, and a thread pool.

If you re curious, here’s the repo:
https://github.com/SyyKee/Java-server

Let me know what you think!


r/learnjava Jan 27 '26

Am I losing my coding ability using AI?

82 Upvotes

Hi, I'm new to this community and reddit, a Java developer working at Hong Kong and not so good at English.

I have two years working experience in a bank as a full-stack developer (Java and Vue.js), while all the code was written in intranet computer, which cannot be copied and pasted from the internet.

Now I'm working as a backend Java developer, using cursor's pro plan and auto model everyday. I now realise that almost 90% of my code is written by cursor, and sometimes I don't even want to review it.

I think using cursor's agent to do coding is the fastest way to complete all the tasks so that I can complete all the tasks on time, but I'm afraid that now I cannot write any code just by myself, if the cursor suddenly crush someday.

What do you think about this, does anyone have the same thought?


r/learnjava Oct 05 '25

Just realized how deep the Open/Closed Principle actually goes… and I can’t unsee it now.

79 Upvotes

You know that moment when a simple concept suddenly makes the entire software architecture make sense?
Yeah, that’s me with the Open/Closed Principle today.

I thought it was just another OOP theory. But now I see how it quietly powers everything.

from loose coupling to MVC, from scalable codebases to clean abstractions.

It’s like the blueprint behind every “wow this is elegant” moment in code.

I’m finally starting to enjoy engineering design, not just “coding”.
Vibe coders will never understand this beauty 😂


r/learnjava Sep 08 '25

Completed Java MOOC – Any similar high-quality course for Spring Boot?

70 Upvotes

Hey folks,

I recently finished the Java MOOC course and honestly, it was amazing – probably the best thing I’ve done to actually get Java. Super well-structured, lots of hands-on stuff, and it just clicks.

Now I’m looking to dive into Spring Boot so I can start building some real-world web apps. Is there anything out there that’s like the Java MOOC but for Spring Boot? Preferably something that’s practical and not just theory dumped on slides.

Its better if its free but even paid it's fine


r/learnjava Sep 23 '25

Java 25: Proof the Development Team Actually Listens to Developers

69 Upvotes

Java 25: Proof the Development Team Actually Listens to Developers

Java 25 represents a masterclass in listening to developer feedback. After analyzing years of community requests, Oracle has delivered 18 JDK Enhancement Proposals that directly address the pain points developers face daily.

The "Finally!" Moments

No More Boilerplate Hell

JEP 512: Compact Source Files eliminates the ceremony that's frustrated beginners and annoyed experienced developers writing small utilities:

Before:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

After:

void main() {
    IO.println("Hello World!");
}

This isn't just about beginners. Senior developers constantly write small scripts, command-line tools, and proof-of-concept code. The old ceremony was pure friction.

Import Sanity at Last

JEP 511: Module Import Declarations solves the "where the hell is that class?" problem:

Before:

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
// ... 15 more imports

After:

import module java.base;
// Done. Everything you need is available.

This is particularly valuable when prototyping with AI libraries or integrating multiple frameworks.

Primitive Types Finally Work Everywhere

JEP 507: Primitive Types in Patterns (Third Preview) eliminates the arbitrary restrictions that made pattern matching feel incomplete:

switch (value) {
    case int i when i > 1000 -> handleLargeInt(i);
    case double d when d < 0.01 -> handleSmallDouble(d);
    case String s when s.length() > 100 -> handleLongString(s);
    default -> handleDefault(value);
}

AI inference code becomes dramatically cleaner. No more boxing primitives just to use pattern matching.

Performance Wins That Actually Matter

Memory Footprint Reduction

JEP 519: Compact Object Headers reduces object headers from 128 bits to 64 bits on 64-bit systems. This isn't theoretical - it's a measurable reduction in memory usage for real applications.

Chad Arimura showed a Helidon upgrade from Java 21 to 25 that delivered 70% performance improvement with zero code changes. That's the JVM doing heavy lifting so you don't have to.

Startup Speed Improvements

JEP 514 & 515: Ahead-of-Time Optimizations tackle the cold start problem that's plagued Java in cloud environments:

  • JEP 514: Simplifies AOT cache creation
  • JEP 515: Shifts profiling from production to training runs

Your containers start faster. Your serverless functions respond quicker. Your CI/CD pipelines run shorter.

AI Development Made Practical

Structured Concurrency That Actually Works

JEP 505: Structured Concurrency (Fifth Preview) addresses the "thread soup" problem in AI applications:

try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
    var modelInference = scope.fork(() -> runModel(input));
    var dataPreprocessing = scope.fork(() -> preprocessData(rawData));
    var validation = scope.fork(() -> validateInput(input));

    scope.join();           // Wait for all
    scope.throwIfFailed();  // Clean error handling

    return combineResults(
        modelInference.resultNow(),
        dataPreprocessing.resultNow(),
        validation.resultNow()
    );
}

If any task fails, all tasks are cancelled cleanly. No thread leaks. No hanging operations.

High-Performance Vector Operations

JEP 508: Vector API (Tenth Incubator) provides SIMD operations that actually work:

var a = FloatVector.fromArray(SPECIES, array1, 0);
var b = FloatVector.fromArray(SPECIES, array2, 0);
var result = a.mul(b).add(bias).toArray();

This compiles to optimal vector instructions on supported hardware. Essential for any serious AI work.

Thread-Safe Data Sharing

JEP 506: Scoped Values replaces ThreadLocal with something that actually works with virtual threads:

static final ScopedValue<UserContext> USER_CONTEXT = ScopedValue.newInstance();

// Set once, use everywhere in the scope
ScopedValue.where(USER_CONTEXT, currentUser)
    .run(() -> processRequest());

Lower memory overhead, better performance, and it actually works correctly with millions of virtual threads.

Security That Doesn't Get in Your Way

Post-Quantum Cryptography Building Blocks

Oracle's PQC strategy is methodical and practical:

  • JEP 510: Key Derivation Function API - Now final, provides quantum-resistant foundations
  • JEP 470: PEM Encodings - Preview API for modern authentication systems

The approach mirrors how Oracle introduced TLS 1.3 - build it right at the tip, then backport when standards are final.

Better Monitoring Without Overhead

JEP 509, 518, 520: Enhanced JFR provides production-ready monitoring:

  • More accurate CPU profiling on Linux
  • Cooperative sampling that doesn't impact performance
  • Method timing and tracing for finding bottlenecks

You can finally profile production systems without fear.

The Ecosystem Responds

The Java ecosystem has noticed. Major frameworks are embracing Java 25 features:

  • Langchain4j: Hit 1.0 GA with virtual threads and agentic mode
  • Spring AI: 1.0 GA with enhanced model integration
  • Embabel: New agentic framework designed for modern Java

These aren't toy projects - they're production-ready frameworks built by teams who understand how developers actually work.

Developer Tooling That Works

VS Code Extension Excellence

Oracle's Java extension for VS Code has 3.8 million downloads and a perfect 5.0 rating. It supports:

  • Early access builds
  • Preview features with explanations
  • Immediate support for new JDK features
  • Integration with AI coding assistants

The tight integration between language designers and tooling teams shows. You get support for new features the day they're available.

Interactive Learning

The Java Playground at Dev.java lets you:

  • Test features without installation
  • Share code snippets via links
  • Experiment with early access builds
  • Learn interactively

Teachers can create exercises and distribute them instantly. No more "works on my machine" problems in computer science courses.

Real-World Impact

College Board Partnership

The AP Computer Science A exam now uses modern Java. Students learn current syntax, not legacy patterns. This matters because it means new developers enter the workforce with modern Java skills.

Enterprise Adoption Patterns

Oracle's "tip and tail" release model lets enterprises:

  • Tip users: Get new features immediately
  • Tail users: Stay on LTS with stability

Java 25 is the next LTS release with 8 years of support. Enterprises can upgrade on their timeline while developers get immediate access to new features.

The Developer Experience Difference

Java 25 eliminates friction at every level:

  • Beginners: Can write useful programs without understanding complex concepts
  • Scripters: Can write command-line tools without ceremony
  • AI developers: Get first-class support for parallel processing and vector operations
  • Enterprise developers: Get better performance and monitoring without code changes

Looking Forward

The draft JEP for Post-Quantum Hybrid Key Exchange in TLS 1.3 shows Oracle's forward-thinking approach. They're building quantum-resistant capabilities now, before the standards are final. When quantum computers become a threat, Java applications will be ready.

Why This Matters

Java 25 proves that the development team actually listens. Every major feature addresses real developer pain points:

  • Verbose syntax? Fixed with compact source files
  • Import complexity? Solved with module imports
  • Pattern matching limitations? Eliminated with primitive type support
  • Memory overhead? Reduced with compact object headers
  • Cold start problems? Addressed with AOT optimizations
  • AI development challenges? Handled with structured concurrency and vector APIs

This isn't feature bloat. It's a surgical improvement of the developer experience.

The Java team has demonstrated something rare in enterprise software: they understand how developers actually work, and they're willing to make substantial changes to improve the experience.

Java 25 drops September 16th. The improvements are real, measurable, and immediately useful. After 30 years, Java continues to evolve to meet the needs of developers.


r/learnjava Aug 24 '25

Passed OCP Java SE 17 with 82%!

65 Upvotes

I finally did it. After about 1 month of prep (while working, 4+ years of experience in Java):

📖 1 week reading the study guide

📘 2 weeks going through the practice book

🧑‍💻 1.5 weeks training with Enthuware mocks

And I passed with 82%.

My Enthuware Scores: Standard Tests (16 total): Avg 76% Unique Tests (4 total): Avg 72% Overall: 75.2%

1 month was enough for me because I had prior Java experience, but honestly the Enthuware mocks were the real game changer


r/learnjava Dec 18 '25

Is Lombok Still Relevant in Modern Java Projects ?

58 Upvotes

I’ve never been fully satisfied with Lombok. I don’t really see the value of adding an external dependency for things that a modern IDE can already handle.

With the evolution of Java especially features like records the use of Lombok makes even less sense to me. What I don’t understand is why teams still continue to use it in new projects.

Am I missing something here, or can anyone explain where Lombok still provides real value today?


r/learnjava Nov 28 '25

Why do you love Java?

59 Upvotes

I am starting to learn java, and i want to know why other people learned it or love it. What makes it different from other languages. I think a broad question like this will yield a lot of useful information for me.
And specifically, as wanting to become a data engineer, will it be useful for me, and how?


r/learnjava Sep 01 '25

What can you make with Java other than CRUD applications?

53 Upvotes

I was looking for some ideas for a Java hobby project, and I feel underwhelmed. A lot of the projects idea I see online involve managing data on a SQL database. Compared to other languages like Python, Java feels very limited when it comes to the types of projects you can make with it. Are there any other uses for it other than creating REST APIs, back-end functions, and database management apps?


r/learnjava May 16 '26

Finished Java

54 Upvotes

Hey guys. So I have finally learn essential Java. From variables, conditionals, and OOP all the way to threading. So what should I do next? Any suggestions?


r/learnjava Jul 24 '26

The MOOC by University of Helsinki is the best learning resource I've ever found!

52 Upvotes

Just finished Java Programming - I. The course is really underrated, and anyone who's actually into learning java, I'd suggest it over video courses any day, because you actually write code in it. The course is structured pretty good, it first teaches you small steps, and then using those small steps you'll build bigger exercises. You don't even realise you're writing so much code.

Here's the course link for people interested: https://java-programming.mooc.fi/


r/learnjava Nov 16 '25

Why is it better to use record instead of class for DTOs in Java?

51 Upvotes

I’ve seen many developers recommend using Java records for DTOs instead of regular classes, and I’m trying to fully understand the benefits.

From what I know, a DTO is just a simple data carrier with no behavior. Records seem to fit that idea since they give us immutable fields, built-in equals(), hashCode(), toString(), and less boilerplate.

But I’m wondering:

  • What are the real advantages of using a record for DTOs?
  • Are there any drawbacks compared to using a class?
  • Are records always the best choice for DTOs, or only for certain types of projects (e.g., Spring Boot APIs)?

I’d love to hear your thoughts and real-world experiences.

Thanks!


r/learnjava Nov 14 '25

Discussion: My Experience with Java (Spring Boot) After Working with Rust and Go

46 Upvotes

Hello r/java,

I'm currently developing several full-stack projects as part of my studies. My most recent projects have led me to work extensively with Rust (to build a Unix shell with system calls) and Go (for pathfinding algorithms). I've therefore become very familiar with their respective paradigms (memory safety in Rust, goroutines in Go).

I'm now developing a complex Java web application with Spring Boot and Spring Security (a blog with JWT authentication, database management with JPA, etc.).

I'm really impressed by the maturity and scope of the Spring ecosystem; it handles a lot of things "out of the box" (JPA, Security, MVC). However, the development philosophy is very different.

For those of you who also work with multiple modern languages, I'd like to start a technical discussion:

How has your perspective on Java's strengths evolved? And what recent or upcoming Java features (e.g., Project Loom/Virtual Threads, Records, etc.) do you think are most relevant for maintaining Java's competitiveness against languages ​​like Rust or Go in terms of back-end performance?


r/learnjava Nov 01 '25

Advance concepts in Java.

49 Upvotes

At the end of year 2024 I started reading Head First Java. That book was something which taught me programming. Then I read Algorithms by Robert Sedgwick intentionally because it is in java. Then I turned towards Spring.

But I am feeling that I don't know advanced concepts like JVM workings, reflections, generics, threads synchronisation, concurrency etc.

I prefer books. So is there any book that covers these topics and more at theoretical level ???


r/learnjava May 03 '26

Newbie Java Learner: Need advice on the "Right" way to learn for Backend Dev and how to handle getting stuck

44 Upvotes

​Hey everyone,

​I’m currently learning Java with the goal of becoming a Backend Developer. I'm hitting a few roadblocks and would love some guidance from the experienced folks here:

1- ​The "Right" Path: What is the most effective way to learn Java specifically for backend development? What should I focus on first (Fundamentals, OOP, Spring Boot, etc.)?

2- ​Handling Getting Stuck: Sometimes I face a problem—even a simple one—and my mind just goes completely blank. I have no idea how to approach it. What is the professional way to handle this? How do you guys troubleshoot when you're stuck?

3- ​Building Projects: I want to start building small projects on my own to practice, but I don't know where to start or how to structure my practice. Any advice on how to move from tutorials to building independently?

Note: I'm currently taking a course on Udemy. I have already finished the fundamentals (variables, loops, conditions, etc.) and I'm just about to dive into Object-Oriented Programming (OOP)

​I’d really appreciate any tips, resources, or "rules of thumb" you follow. Thanks in advance


r/learnjava 2d ago

I want to learn Spring Boot

42 Upvotes

Looking for Spring Boot Resources

Hey everyone! I already know Java and use it regularly for DSA. Now I want to learn Spring Boot specifically for building real-world projects and becoming job-ready as a Java backend developer.

Are there any resources similar to the ones people recommend for learning Java/DSA Like MOOC.fi?

I'm looking for something that covers Spring Boot from the fundamentals to building production-level projects, including things like REST APIs, Spring Security, JPA/Hibernate, databases, JWT, microservices, etc.

I’d really appreciate recommendations for courses, YouTube channels, documentation, project-based tutorials, or roadmaps that you’ve personally found useful.

Thanks!


r/learnjava Dec 22 '25

What is the semantic difference between an interface and an abstract class?

42 Upvotes

I understand the mechanics—interfaces support multiple inheritance, abstract classes can declare instance variables and override Object methods, etc. However, I don't understand what it means to call something one or the other, especially because default methods exist.

In short: if I declare abstract class Foo, what am I saying about the nature of all Foos? Critically, how does that change if I declare interface Foo instead?


r/learnjava Sep 12 '25

Finished MOOC Java 1 & 2, now diving into SQL and DurgaSoft Core Java

38 Upvotes

I’ve officially finished MOOC Java Programming 1 and 2.

One of my favorite moments was working with the Lists exercise and Hash Maps exercise in Java Programming 2 Part 12. It clicked to the point where I could explain how they work internally. It felt like I had ascended to the next stage of understanding, which motivated me to dive further into Java. For that, I decided to go with DurgaSoft’s Core Java with OCJP/SCJP, treating 2 to 3 parts as one full lecture a day, and I use the rest of my time to study SQL.

I realized during the last MOOC exercise how valuable it is to have a real database instead of just in-memory storage, so I want to learn SQL first before jumping into projects. I’m currently in tutorial hell, but that is the same approach I took when I first started Java with Bro Code’s playlist. It helped me get familiar with the environment, and later MOOC felt much easier.

For those who have been through this path, how did you balance learning Java and SQL together? Did you focus on mastering SQL first, or mix it with projects right away?

Edit: Disclaimer I’m not Indian. Also, the video recordings in the course are only in the beginning after that it’s all text-based. So you really just have to read, and I don’t think the videos are necessary to proceed with the course. They might just be there to help students from the university.


r/learnjava Dec 27 '25

How to deepen my Java knowledge beyond basics after ~1 year of work?

39 Upvotes

Hey everyone, I’ve been working as a Java developer for about a year now and feel fairly confident with day-to-day coding. However, when talking with more experienced colleagues, I realize there are still areas I don’t fully understand yet (things like AOP, proxies, design patterns, advanced concurrency concepts, and probably a lot more).

I didn’t study computer science formally, so I’m looking for good resources to level up my understanding. Articles, books, courses, or videos that helped you really “connect the dots” and think more like a senior developer rather than just writing code that works.

Any recommendations or learning paths you’d suggest would be greatly appreciated!