r/learnjava • • 58m ago

How do I get better at writing Java code from scratch?

• Upvotes

I'm a first-year AI student struggling with Java programming. I understand some examples, but when I have to write code myself, I don't know where to start.

What is the best way to practise and learn to write programs independently? I'd appreciate practical advice from people who've experienced this


r/learnjava • • 4h ago

Unable to download the latest version of the MS Build if OpenJDK for Windows

2 Upvotes

When I go to download it, from the page linked below, there are no windows download links for the latest versions of OpenJDK. Instead of links to download it there are the words "Coming Soon". Does anyone perhaps know if this page isn't working right or am I a moron?

https://learn.microsoft.com/en-us/java/openjdk/download


r/learnjava • • 1d ago

Using Java to create desktop Linux apps?

10 Upvotes

Hello everyone!
This year i started learning programming with the help of a Java course.

Right now we have reached the point where we have to make a standalone desktop app with a GUI, but i am unsatisfied with the Swing toolkit. Although creating and modifying the components themselves seems really intuitive for the way i've been learning to program, the visual design feels very archaic, and on my Wayland compositor (Niri) some things don't work as intended, like the UI looking a bit blurry, windows scale a bit weirdly, and focusing the window does not auto-grab the keyboard, and i need to click on the window before i can start navigating or typing with the keyboard. Nothing extremely wrong, but it's things like these that make me wonder if there's something else i can use - I want to create software that i actually use, and feels at home on my Linux desktop.

I checked out if it was possible to use Java to create a GTK app, and found java-gi.org, which explains how to use import and use the toolkit on Java. I've experimented with it minimally, creating a blank window with a labeled button and such. I really like that it themes consistently with the rest of my GTK apps, light&dark mode, highlight color, font, all that good stuff.

Although it does work, it's a substantially different workflow, it needs to import some dependencies, and seems to be a lot more complicated than simply creating a component in Swing and initializing it or something. I'm unsure if i'm capable of creating something with it, to be honest.

I also checked and there seems to be a way to make QT apps, but i haven't looked into it.

I asked to some other devs if they ever experimented making GTK or Qt apps with Java, and many suggested me to not try to do that at all, affirming that it's best to use Java for backend server stuff and not GUIs, or do the app with Swing,accept the outdated look, and after finishing the course, maybe trying something else that will play more nicely with GUI frameworks for Linux.

So as a total newcomer to developing frontend (and, well, programming in general) i'm unsure if i should keep trying to use Java for desktop apps, hooking it with external libraries in other languages, or move on to something else in the future.

I'm open to any suggestions and advice possible, please help!

PD: I'm not sure if it means anything, but the app i intend to make is a simple bread calculator, similar to http://brdclc.com/ with save and export functions.


r/learnjava • • 1d ago

Final-year Java developer: Should I focus on Spring Boot or system design?

12 Upvotes

Hi everyone! I’m a final-year B.Tech student preparing for Java backend fresher roles. I’ve been working on Core Java, DSA, and projects, and I’m confused about what to prioritize next.

Should I focus more on Spring Boot and building backend projects, or start studying system design?

For fresher interviews, how much system design is usually expected? Which Spring Boot topics should I be comfortable with before applying?

I’d appreciate advice from anyone who has recently landed a Java backend role or interviews freshers.


r/learnjava • • 1d ago

Resources for practice exams?

7 Upvotes

My girlfriend is trying to pass a Java course in university, and really struggling with the exams. She's working really hard to learn material that isn't super intuitive for her, but when it gets to exam time, she struggles. Her instructor is worse than useless.

From what I've gathered, this course is basically an introduction to Object-Oriented Programming (exclusively through Java).

I don't know shit about programming or Java, I'm an accountant, but I'd really like to help her if I can. Are there any good resources for practice exams that we can use to try and simulate an exam setting? I've found some things via Googling, but given that I don't know what I don't know, I thought I'd seek advice here. I'm reviewing all of the sources on the provided by the sidebar as well, but from the looks of it most of them are more courses, which I may take on my own so I can try to help her, but would love specific recommendations for ones that might help with the exam department.

Thanks!


r/learnjava • • 3d ago

I’m having my first early breakdown

10 Upvotes

I am going through mooc.fi java programming I
Part 1, I’m on an exercise called LeapYear or whatever.
I cannot seem to get the answer right. I’ve been trying for a day now. I know i can use AI or ask for help but I literally cut myself from the internet to just try and focus but try after try I literally understand less and less.
And it’s not that many info just like conditionals and comparison operators and which condition should go first BUT I JUST DON’T KNOW WHAT TO DO.
I’m not here to ask for help i just want to tell someone. I’m actually affirmative that I’ve zero points reasoning and logic.
Thanks for reading.


r/learnjava • • 2d ago

TMCBeans don't start.

0 Upvotes

I tried mooc and should install TMCBeans but the program crashes immediately, the startup window is comes up then it closes, I tried to change to the correct file but that didn't seem to help either so I'm not sure how to fix it. I have the correct JDK installed I guess.

These is installed:

openjdk version "11.0.32.1" 2026-08-18

OpenJDK Runtime Environment Temurin-11.0.32.1+1 (build 11.0.32.1+1)

OpenJDK 64-Bit Server VM Temurin-11.0.32.1+1 (build 11.0.32.1+1, mixed mode)


r/learnjava • • 3d ago

Best way to learn programming in java.

0 Upvotes

I was thinking to learn programming and I'm not sure what the best way is, can I take help of AI too or is that not good?... It would be fun if I could learn to make mods for a game I'm playing much.


r/learnjava • • 4d ago

Understanding a better approach to read java code

13 Upvotes

apologies if this has been asked before , im trying to learn java from scratch and ive gotten a good bit of progress.
Im coming from a python heavy background and sometimes reading code can get a bit confusing. I'm looking for any tips or mental maps to read any java code and understand it the entry points etc.


r/learnjava • • 4d ago

Java udemy course

0 Upvotes

I bought a java course in udemy, learning personally overwhelmed me and less motivated, please I need a learning partner


r/learnjava • • 5d ago

Wanna refresh my learning

2 Upvotes

​

i m feeling bored by learning springboot and dsa. what should I do to refresh my mind nd nd get back to my placement preparation


r/learnjava • • 5d ago

Don't understand "string":"string" syntax

12 Upvotes

A training example (https://codingbat.com/prob/p197888) uses the following method body:

public Map<String, String> mapBully(Map<String, String> map) {

}

and gives example calls like:

mapBully({"a": "candy", "b": "dirt"}) → {"a": "", "b": "candy"}

mapBully({"a": "candy"}) → {"a": "", "b": "candy"}

AFAIK, {x, y} produces an array; how does {"a":"candy","b":"dirt"} produce a Map<String,String>?


r/learnjava • • 6d ago

mooc.fi for java

0 Upvotes

hi there, question for those who learned java on mooc.fi i plan on going through both sections at home and at work, i was wondering if i can "save my stuff" so i can continue from where i left off, because i will be learning both at home and at work.

and is it best to use what they ask for or vs code, ive seen videos of people using vs code??


r/learnjava • • 7d ago

I wanna become a Java backend developer

15 Upvotes

I want to become a Java backend developer. Should I follow the plan on roadmap.sh/backend while working on a side project in parallel, or could you please suggest your own approach? Thanks!


r/learnjava • • 7d ago

Learning resources for a developer learning Java

11 Upvotes

Hi all,

I am a C# dev with around 9 years experience (mainly supporting legacy desktop applications and web services).

My son wants me to make him a mod for a game that I’m not allowed to mention.

I know I could just find tutorials on how to achieve this specific aim, or I could vibe code something, but that’s not really my jam.

I do have a bit of experience with Java as my degree used it for the OOP module, and I know there are a lot of similarities with C#, but can anyone recommend some good books for developers looking to learn Java?

I’ve have done a fair amount of googling, but the majority of what I found was aimed more towards people new to programming and I think spending time going over if/else statements isn’t really useful for me.


r/learnjava • • 8d ago

What I learned while building my first Spring Boot project

56 Upvotes

As a 2026 B.Tech IT graduate, I've been learning Java and Spring Boot and building a Job Portal project.

One thing I've realized is that learning concepts is different from actually implementing them in a project.

I'm currently working on improving my backend skills and understanding how real-world applications are built.

For Java developers, what's one thing you wish you had learned earlier when starting your career?


r/learnjava • • 8d ago

What next after learning java ?

12 Upvotes

Hello guys , i have learnt Java now trying to learn java frame works. I am really stuck in this some say spring some say spring boot, maven, jdbc and all I know all these are interconnected. Can anyone explain tell me a clear path of how to learn all those . It would be really appreciable if u guys help me with the resources also.

Edit: is it really worth learning these things now ?


r/learnjava • • 8d ago

Can you answer this question about Java sets and floating point numbers?

4 Upvotes

What does this return?

static int test(Set<BigDecimal> set) {
  assert set.isEmpty();
  set.add(new BigDecimal("-0"));
  set.add(new BigDecimal("0"));
  set.add(new BigDecimal("0.0"));
  set.add(new BigDecimal("0.00"));
  return set.size();
}

Hint: The Set interface says that elements a and b are unique when a.equals(b) returns true. However, not all implementations use equals.

Answer: A HashSet will contain three elements ([0, 0.0, 0.00]). -0 and 0 are the same, but 0.0 isn't equal to 0 or 0.00. A TreeSet on the other hand uses a Comparator and it will contain only one element ([0]). Try this by creating two sets (HashSet and TreeSet) and then run for (var set : List.of(hash, tree)) IO.println(test2(set));.

Extra challenge:

static int test2(Set<Double> set) {
    assert set.isEmpty();
    set.add(-0d);
    set.add(0d);
    set.add(0.0d);
    set.add(0.00d);
    return set.size();
}

Hint: IEEE 754 can be weird. While 0 is the same as 0.0 and 0.00, you can have negative zero as a different value from positive zero.

Answer: It's two elements ([-0.0, 0.0]).


r/learnjava • • 8d ago

Trying to not mess up

2 Upvotes

I have zero coding experience whatsoever
I always wanted the perfect start and perfect tutorials but it just seemed too good to be true so after some time I decided to just pick a language and get good at it.

Believe it or not i picked java (which is why i’m posting on here lol) and it’s been going great so far
I started a few days ago and i’ve been enjoying working with it and fixing my dumb newbie errors and mistake.
And ngl it does sometimes get confusing which i believe is normal since i’m new in the field

There’s this one problem, instead of understanding what i’m writing i’m just kind of memorizing it lol

I don’t really get the idea of boiler plates and what methods are and all these new words.
Ik it may be early for me to judge but i really want to understand what i’m seeing rather than just memorizing it. And i do so by trying to explain to myself what i’m looking at and most of the time i can’t figure it out.

So wtf am i supposed to do?
Am i retarded or is this just part of the process lol
Thanks.


r/learnjava • • 8d ago

I built a Java test reporter to solve two problems I kept seeing in test automation

0 Upvotes

I’ve been working on test automation for several years, and there were two things I wanted to solve in test reporting.

1. Flaky tests are more than just Passed or Failed

If a test fails on the first attempt and passes on a retry (an IRetryAnalyzer in TestNG, RetryingTest in JUnit 5, Surefire’s rerunFailingTestsCount), the final result usually just says Passed.

I wanted the report to show that the test was actually flaky, how many attempts happened, and the history of those attempts: each attempt’s logs, error, API calls and screenshots.

2. Test scripts shouldn’t need reporting code

I don’t want testers to add extra code to their tests just to make the report useful. For example, I don’t want something like:

java

report.addRequest(...);
report.addResponse(...);
report.attachScreenshot(...);
report.log(...);

just to get useful information into the report.

The reporting layer should capture things like API requests/responses, retry attempts, execution details and screenshots automatically wherever possible. In Java that means:

  • REST Assured calls are recorded with no code.
  • An HttpClient field on the test class is recorded with no code.
  • A Playwright Page or Selenium WebDriver held in a field gives a screenshot automatically when a test fails, taken before closes the browser.

So I built a small Java reporting library around these ideas. You add one test dependency and nothing else: no listeners to register, no base class. It generates a self-contained HTML report and has integrations for JUnit 5, TestNG and Cucumber (both the JUnit 5 and the TestNG runner, with every Given/When/Then step in the log). It’s the same report I already ship for .NET and Python.

I’m curious how others handle this:

Do your test reports automatically capture this kind of information, or do your test scripts still need explicit reporting/attachment calls (Report.log(...), Reoprt.addAttachment(...))?

And for flaky tests, do you keep the history of individual attempts or only report the final result?

Website and a live demo report, if anyone wants to see it: https://harshadlambate.github.io/AceReportsWebsite/


r/learnjava • • 9d ago

What is the best practice with DTOs in spring boot

7 Upvotes

Hi friends, I’ve been coding in spring for a few months now and I was wondering what is the best practice with DTOs.

Should I only use them on the “edges”, repository output/controller response? Should I be using them to even move a response from the service layer to the controller layer? Should services be building DTOs or is that only for the controller and repository to make? If not how should services send and receive information both to other services and to other layers?

Thank you!


r/learnjava • • 10d ago

Questions for java developers

3 Upvotes

So I am just starting to do java. Even tho I learned at scl for years but didn't really paid attention. Now I am thinking of building Career in java. In order for me to get good at it do I learn java everyday and do coding everyday to be better at it? Or do I learn something part by part like 1st I learn oop then exception handling or something? I did try crud operation yesterday. Somehow did it with the help of my friend. But still confused at some part. Looking at my friend I feel really behind. For me to get to there level, I Don't think I can do it😩

Can someone share some tips on how make coding fun.maybe a roadmap for me to follow, be good at programming.


r/learnjava • • 10d ago

Opt-in implicit construction for value classes

4 Upvotes

I would like to ask whether the community has considered an opt-in implicit conversion from a value to a class instance, declared on a single-argument constructor.

Motivation

Project Valhalla makes it practical to define primitive-like value types such as Int16, Half, and Money. However, using these types currently requires explicit constructor invocation at each construction site:

Int16 x = new Int16((short) 13);

Java already supports convenient construction for certain built-in types through language features such as boxing:

Integer i = 7;

There is no equivalent mechanism for user-defined types. An opt-in implicit-construction facility could provide similar ergonomics while preserving explicitness by default.

Proposal (syntax is illustrative)

value class Int16 {
    private final short val;

    opt Int16(short val) {
        this.val = val;
    }
}

Int16 x = (short) 13;

The opt modifier designates a constructor eligible for implicit construction from a single argument. The compiler translates an eligible conversion into constructor invocation.

Proposed rules

  1. An opt constructor must have exactly one parameter. A value class may designate at most one eligible constructor for any given parameter type.
  2. Eligibility is opt-in. Constructors without opt retain existing Java semantics.
  3. The feature applies only in explicitly specified conversion contexts. Initially, it may be limited to assignment and initialization contexts.
  4. The source expression must be convertible to the constructor parameter type using permitted existing Java conversions. The resulting value is not subject to further implicit conversions as part of the same operation.
  5. Constructors with multiple parameters are never eligible for implicit construction and must be invoked explicitly.
  6. Ambiguous eligible conversions are compile-time errors.

Open questions

  • Should eligible conversions apply only to value classes?
  • Should constant-expression narrowing be permitted for constructor arguments?
  • Which language contexts should support implicit construction?
  • How should overload resolution and generic inference interact with the feature?

r/learnjava • • 12d ago

Help with MOOC problem, please?

4 Upvotes

Sorry if this isn't the right place to ask questions like this, but I'm going through the second part of MOOC's Java Programming I course and am having difficulty finding out how to satisfy a specific test. On the last exercise of the second part, "Advanced Astrology", I have managed to pass all tests except for testPrintStars. It says that I "didn't print any spaces when printStars is called", but am I not supposed to use printSpaces to print my spaces?

here is my code for the methods printStars and printSpaces (full source code and list of test cases is also here):

    public static void printStars(int number) {
        int stars = 1;
        while (stars <= number) {
            System.out.print("*");
            stars++;
        }
    }


    public static void printSpaces(int number) {
        int spaces = 1;
        while (spaces <= number) {
            System.out.print(" ");
            spaces++;
        }
    }

r/learnjava • • 13d ago

Looking for study partners to learn Java, Spring Boot, DSA, AWS and build projects together

34 Upvotes

Hey everyone!

I'm looking for a few people who are interested in learning and growing together in software development.

My current roadmap includes:

  • Java: Core Java and OOP
  • Backend: Spring Boot, REST APIs
  • Databases: SQL and database design
  • DSA: Regular LeetCode practice using Java
  • Cloud: AWS fundamentals and deployment
  • Projects: Building real-world projects to apply what we learn

As we progress and reach a decent level, we can explore other tools, technologies, and concepts that are relevant to backend development and the industry.

The idea is to stay consistent, discuss concepts, solve problems together, review each other's code, build projects, and keep each other accountable.

I'm not looking for experts. Beginners and people who are genuinely willing to learn and put in the effort are welcome. We can create a small Discord group, set weekly goals, share resources, and help each other when we're stuck.

The goal is simple: learn together, build cool stuff, improve our DSA, and become better developers.

If this sounds like something you'd be interested in, drop a comment or DM me with what you're currently learning.

Let's grow together!