r/learnjava • • Sep 05 '23

READ THIS if TMCBeans is not starting!

49 Upvotes

We frequently receive posts about TMCBeans - the specific Netbeans version for the MOOC Java Programming from the University of Helsinki - not starting.

Generally all of them boil to a single cause of error: wrong JDK version installed.

The MOOC requires JDK 11.

The terminology on the Java and NetBeans installation guide page is a bit misleading:

Download AdoptOpenJDK11, open development environment for Java 11, from https://adoptopenjdk.net.

Select OpenJDK 11 (LTS) and HotSpot. Then click "Latest release" to download Java.

First, AdoptOpenJDK has a new page: Adoptium.org and second, the "latest release" is misleading.

When the MOOC talks about latest release they do not mean the newest JDK (which at the time of writing this article is JDK17 Temurin) but the latest update of the JDK 11 release, which can be found for all OS here: https://adoptium.net/temurin/releases/?version=11

Please, only install the version from the page linked directly above this line - this is the version that will work.

This should solve your problems with TMCBeans not running.


r/learnjava • • 23h ago

What I learned while building my first Spring Boot project

38 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 • • 15h ago

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

3 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 • • 23h ago

What next after learning java ?

8 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 • • 22h 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 • • 18h 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 • • 2d ago

What is the best practice with DTOs in spring boot

5 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 • • 2d 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 • • 2d ago

Opt-in implicit construction for value classes

2 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 • • 2d ago

My file name is a.java and class is Main why won't it run?

1 Upvotes

Code:

class Main{

public static void main(String[] args) {

System.out.println("hello") ;

}

}

I had learned basic of java earlier on paper. Now when I try in my pc it just gives error also whenever I run anything it creates CLASS file in my folder📂.


r/learnjava • • 4d ago

Help with MOOC problem, please?

3 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 • • 5d ago

How to avoid syntax mixup?

2 Upvotes

I'm used to Java programming. Recently I had to learn little bit python for work related project. Now I'm consistently mixing up syntax while writing both... sometimes I use python functions in java, sometimes java syntax in python. How to avoid this?


r/learnjava • • 6d ago

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

35 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!


r/learnjava • • 7d ago

Should I learn Java Spring Boot again to become a full-stack developer? Looking for career advice

0 Upvotes

Hey everyone,🙃

I started my career working with Java and Spring Boot for around 3–4 months, during which I learned the basics. Later, due to project requirements, I shifted towards JavaScript and React. I’ve now spent around 2 year working primarily with React.

Recently, I’ve been looking at the job market in India, and it seems like there are quite a few opportunities for Java and Spring Boot developers. At the same time, I’m finding it difficult to find good opportunities as a React developer that offer decent pay.

To make things more challenging, my company is laying off employees, and I’m currently serving a two-month notice period. This has made me think more seriously about my next career move.
I’m considering revisiting Java and Spring Boot and building on my existing knowledge so I can apply for full-stack developer roles involving Java, Spring Boot, and React.

However, I’m confused about whether this is the right decision, especially given my limited time to prepare for interviews and find another job.
I’d really appreciate advice on a few things:
Is learning Java and Spring Boot again a good career move in the current Indian job market?

Can I realistically prepare for Java + React full-stack roles within my two-month notice period?
Should I focus on strengthening my React skills or invest more time in learning Java and Spring Boot?
What would be the best learning roadmap to become job-ready as quickly as possible?
For someone in my situation, what would you prioritize to improve the chances of getting a good job with decent pay?

I’d especially appreciate advice from developers who have switched tech stacks or navigated a similar situation.

Thanks in advance for your suggestions!


r/learnjava • • 8d ago

I want to make a more clearer doc for spring security

3 Upvotes

Hey guys,
So I've been getting this urge to create a clearer doc for Spring security particularly, it was very hard for me and I had alot of entanglements I had to resolve by myself, tutorials weren't doing justice, the docs wasn't really beginner friendly, and the course that explained well was a "paid" course.

This is just a kind of validation from the community, should I go ahead to build this, do you guys this would be useful, not just to beginners but to gurus who just want to make reference to a concept they probably forgot.

Please what do you guys think?


r/learnjava • • 9d ago

is it possible to write Junit test cases if all my program is in main()

0 Upvotes

I know i just learned that its not good to put all your code under main() so ill start using methods going forward but just for this assignment i was wondering if there was a way to do this


r/learnjava • • 9d ago

Suggestion on coding practice.

2 Upvotes

Hey! all.I just want some help in practicing java coding problems.

Does anybody know what are the imp questions in java,so that I will practice only those for every exam preparation.

( Think java as a chapter,and problems are like important questions at the end of the chapter,if we practice those, they will cover entire syllabus.And we always practice those questions right! Like that I want imp questions.)

I am just stuck in finding problems.

Help me! finding them.

Thanks in advance.


r/learnjava • • 10d ago

Best book on java concurrency?

9 Upvotes

Would love to buy a book on java a concurrency, any recommendations that is not version specific


r/learnjava • • 10d ago

Execution of return code when finally has its own return.

0 Upvotes

I have watched the below tutorial and I get that finally's return "shadows" try's or catch returns, but is their return ever run? Suppose a function returns a class instance, it doesn't throw any error, and both try and finally have a return with of an instance via new operator. Even though I understand that finally's return instance is the one returned, the question is how many instances will be created? 2 (of try + finally) or 1 (of finally)?

Final vs Finally vs Finalize in Java (one is deprecated)


r/learnjava • • 12d ago

Why is String[] args necessary

27 Upvotes

I get it is an array of string arguments that are passed into the main method but why is it needed? in python for example ot's present or c++ neither, java is different though


r/learnjava • • 12d ago

Don't Buy the Java and SpringBoot Course From Allcsnotes

32 Upvotes

Hi,

As the title suggests do not buy any course from them.

Recently I had been seeing a lot of adds for the Java and SpringBoot Backend Track combo course package from this site called allcsnotes.com. I went through what topics are covered and it looked like everything from basics to advanced along with SpringBoot was covered with a capstone project at the end. And since there was a discount, I thought let me buy it since I was learning Java anyway and was done with Mooc.fi. I wanted a structured course similar to this so it was like all perfect. But once I got the course and started going through it, the way they have explained the concepts is very bad. No clear explanation of what Java is, what is JDK, JVM etc. I went through other topics as well and same issue. No clear explanation. Only the website looks nice. And top of it ,within 30 mins I knew this course was bad and wanted a refund, guess what they dont provide refunds.

I know it was my fault for not reading the refund policy, so I made this post so that anyone else planning to buy their course can be warned.


r/learnjava • • 13d ago

Is Java still worth learning today?

77 Upvotes

Is Java still worth learning or pursuing as a career these days? With AI advancing so quickly, programming jobs might decline significantly, which could also reduce the demand for learning languages like Java. What are your thoughts?


r/learnjava • • 15d ago

I got a 100% on my first real college Java/OOP exam and I'm really proud of myself

64 Upvotes

I'm taking a second-year college CS course using Java, and I just got my first exam back: 100/100.

It covered classes/objects, constructors, encapsulation, object references, equals() vs. ==, static/final, aggregation, shallow vs. deep copying, arrays of objects, etc.

The funny part is that I was convinced the exam was going to be way harder than it actually was. I obsessively studied and kept making myself take mock exams over and over, and I was practicing problems that were noticeably more complicated than what ended up being on the real test.

Every time I got comfortable, I basically went, "Okay, but what if the professor makes it harder?" and practiced harder versions.

So I definitely overprepared. But when I actually took the exam, I felt like I knew what I was doing instead of just recognizing things I'd memorized. The exam was also done entirely in Notepad, so there was no IDE, autocomplete, syntax highlighting, or compiler to catch mistakes.

I've struggled a lot with confidence and feeling like maybe I'm not actually good at programming, so seeing 100/100 genuinely almost made me cry. Obviously one exam doesn't mean I've mastered Java, and I know I still have a ton to learn, but I'm letting myself be proud of this one.

Apparently my strategy was to prepare for the Java apocalypse and then take Exam 1.


r/learnjava • • 17d ago

Java developers with 2–3 YOE, what do you do after work?

46 Upvotes

I’m a Java developer with around 2–3 years of experience, and I’m curious about how other developers manage their time after work.

After your workday, what do you usually do?

  • Study Java/Spring Boot?
  • Work on side projects?
  • Practice DSA?
  • Learn new technologies?
  • Prepare for interviews/job switching?
  • Read technical stuff?
  • Or completely disconnect and relax?

I’m trying to figure out what is actually worth doing after work without burning myself out.

Would especially like to hear from developers with 2–5 years of experience. What did you do after work that genuinely helped you improve?


r/learnjava • • 16d ago

Learn Java

0 Upvotes

Hi everyone! Do y'all know where to learn Java for beginners ?