r/javahelp

Deep Java Learning Guide

I want to become a strong backend engineer and I’m planning to learn Java deeply along with Spring Boot and Microservices architecture.

There are so many courses and playlists online that I’m confused about what’s actually worth following seriously for long-term growth.

I’m looking for recommendations for:

Core Java

Advanced Java

Spring Boot

Microservices

MySQL/Database design

Backend engineering fundamentals

Industry-level project building

I don’t just want tutorial-level knowledge. I want resources that help build strong engineering fundamentals and real-world backend skills.

Would love recommendations for:

Best YouTube channels

Paid courses

Books

Roadmaps

Any underrated resources

Also, should I focus more on:

Java + Spring ecosystem deeply or

Full-stack development with many technologies?

Would appreciate guidance from experienced backend engineers.

reddit.com
u/Narrow_Computer1006 — 22 hours ago
▲ 2 r/javahelp+1 crossposts

Excel bulk process in java project.

Hi, currently I'm using sax parser for read bulk excel data in java automation framework, is there any other best approach better than using sax parser? I want to improve performance and minimize memory utilization.

reddit.com
u/Majestic_Drawing_908 — 4 days ago

Data Knowledge Gap

Hello , needed a bit of guidance from senior devs.

Scenario - I am currently working on a springboot application which uses MongoDB + ElasticSearch , I was assigned a bug (which I solved) , now in order to solve it I used a particular variable obtained from ES response (lets call it dSR-Id). I used this variable in order to segregate rows exported in csv file. Now when I asked my senior to review it , she started asking me why specifically I used this variable & not the other existing variables. I tried justifying it but my justification wasn't upto the mark. Can someone help me what kind of analysis or KT is required to overcome this ? Would a functional KT be sufficient to cover up this gap ?

reddit.com
u/No_Main8842 — 4 days ago

Generating random int within bounds

*Reposting as my last question was too vague*

I am a bit stuck with an assignment at the minute. The task requires the use of the util package to generate a random int with a given amount of digits. For example, if the given digit was 3 - the program would generate a number with 3 digits (192, 123, 904, etc), or if the given number was 6 - it would generate a number with 6 (000934, 123456, etc). I know how to generate an int within bounds using a random object, however I wanted to ask if there is a built in function for this?

If not, I was thinking of writing a number of if statements along the lines of:

(pseudo)

if number == 3 {
code = random.nextInt(100, 1000); }

if number == 4 {

etc etc. }

^ but this has issues as I should also be able to generate numbers with leading zeros.

If anyone could help out a bit, that would be awesome. Thanks

reddit.com
u/DesperateSupport8315 — 4 days ago

Java Test

guys i have a final tmrw, and there's this question that i'm stuck on. I'm pretty bad at java so plz be nice, i usually use the questions and search up the answer for now to understand the context, and for this question chat gpt keeps saying the answer is XXX, but it's not true.

What is the output of this Java fragment:

int а = -4;
double y = а / 3 + a;
System.out.println(у);

(Write XXX in case of errors.)

any help would be appreciated, also, any studying strategy to do good on the final for tmrw would also be appreciated...

it's a intro to object oriented programming course...

Thanks a bunch!

reddit.com
u/South_Alarm_4583 — 5 days ago
▲ 3 r/javahelp+1 crossposts

Type-safe SQL in Java without the bloat: Inferred JOINs based on JPA annotations

Hi everyone,

I’ve been working on a lightweight ORM module for Ujorm3, aiming for a sweet spot between raw native SQL safety and the heavy weight of full-blown ORMs like Hibernate.

One of the neat features we implemented is automatic JOIN type resolution derived directly from standard JPA metadata (like nullable=false), combined with a compile-time generated metamodel.

Here is a quick look at how a SelectQuery handles relations, multiple tables, and custom SQL tails fluently:

final var ctx = EntityContext.ofDefault();
final var employeeEm = ctx.entityManager(Employee.class);

List<Employee> select(Connection connection) {
  return SelectQuery.run(connection, employeeEm, query -> query
    .sql("SELECT")  // Optional custom start
    .columns(true)  // Loads all table columns including foreign keys
    .column(MetaEmployee.city, MetaCity.name)     // Auto-generates INNER JOIN 
    .column(MetaEmployee.boss, MetaEmployee.name) // Auto-generates LEFT JOIN 
    .where(MetaEmployee.id.whereGe(1L).and(MetaCity.id.whereGe(1L)))
    .tail("ORDER BY", MetaEmployee.id) // Optional custom end
    .toList()
    );
}

How it works under the hood:

  • Zero Reflection at Runtime: The library compiles its own bytecode at runtime for lightning-fast domain object manipulation, matching the speed of handwritten Java.
  • Smart JOINs: If a mandatory object attribute is marked as nullable=false in your JPA annotation, the query engine automatically spins up an INNER JOIN. Otherwise, it defaults to a LEFT JOIN. No manual string stitching required.
  • Type-Safe Path Mapping: Notice the MetaEmployee.city, MetaCity.name chain? It provides a compile-time safe path for multi-relational mappings, backed by an APT processor.

The goal here was keeping the codebase minimalistic to extend maintainability and eliminate runtime surprises (like dreaded lazy-loading exceptions, since we chose not to support lazy-loading at all).

I'd love to hear your thoughts on this approach! Do you prefer your SQL builders strictly native, or do you like this level of automation?

reddit.com
u/Enough_Arrival_7335 — 5 days ago

Generating random numbers with certain length

Hi all,

I am trying to generate a random number with the length of given input from the user. Is there a simple way I can implement this? I am using util.Random for this. Cheers

reddit.com
u/DesperateSupport8315 — 5 days ago

Started learning Java recently and really enjoying the process of building logic, understanding OOP concepts, and creating small projects step by step.

let me know your thoughts about it

reddit.com
u/Wise_Safe2681 — 5 days ago

[Maven/IntelliJ] Spring-JDBC dependency remains red (Artifact not found) while spring-context works

Hello, I am new to the world of spring and java backend in general. I am starting with "Spring Start Here" by Laurentiu Spilca.

I am having a strange issue with my pom.xml in IntelliJ. While my spring-context dependency seems to be accepted, the spring-jdbc dependency remains red no matter what I do.

The Problem:
When I use version 7.0.7 (which IntelliJ suggested), spring-context turns white, but spring-jdbc stays red with the error "Artifact not found."

What I have tried:

  1. Changed versions to 5.2.6.RELEASE and 5.3.9 — both remained red for both dependencies.
  2. Clicked "Reload All Maven Projects" multiple times..
  3. Checked Proxy settings (No Proxy). (Honestly, gemini told me to do this, I have no idea why I need to do this.)

My Environment:

  • IDE: IntelliJ Community Edition
  • Java: 17
  • My pom.xml code:

​

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>new_maven</artifactId>
  <version>1.0-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>7.0.7</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>7.0.7</version>
    </dependency>
  </dependencies>

  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>

</project>

the error it is showing is in this part

<artifactId>spring-jdbc</artifactId>
<version>7.0.7</version>

how to rectify this error? why is this error happening?

reddit.com
u/Potential_Spot_5847 — 5 days ago

Is there a way to opt-in to sun.misc.Unsafe deprecation early without a command line argument?

solved: /u/davidalayachew to the rescue with the @argfile syntax I was unaware of.


This question has been frustratingly difficult to research. Plenty of content out there from people who want to keep using their unsafe access without warnings, but I'm in a different camp.

A couple of tools I maintain use Guice (to my great Misery).

Guice is doing a really neat thing where it doesn't actually NEED sun.misc.Unsafe, but it's using it anyway. If I specify --sun-misc-unsafe-memory-access=deny the only thing that breaks is some absolutely bizzare error message enhancement they're implementing with ASM. The problem is that the library is either doing some preemptive checks for Unsafe features or is still using them preferentially, even under JDK 25 and 26.

Telling my users to just ignore the warnings and telling them to use that monstrosity of a command line flag are equally unsatisfying.

The only clear answer I can see, and the one I'm seriously considering, is adding a java agent to my app with the sole purpose of dynamically rewriting all the uses of sun.misc.Unsafe to throw UnsupportedOperationExceptions.

Before I go off the deep end with that, has anybody dealing with a similar situation come up with a more elegant solution?

reddit.com
u/hungarian_notation — 6 days ago

best obfuscator

Hello i need really good obfuscator for my java project so no one cant rlly reverse it like i mean it should be hard to reserve it is proguard good or some other better alternatives?

reddit.com
u/SherbertBorn8454 — 7 days ago

arraylist vs list

pls help, lets say i need an array of list.

for what purposes would i use an arraylist<string> vs a string[ ]

thanks

reddit.com
u/BadismPlayz — 9 days ago

Would like an explanation on the difference between local and static VarHandles

Hello everyone o/

I currently try to get into VarHandles and MethodHandles because the Unsafe API was deprecated in JDK 23 and marked for removal.

While I was doing some tests I noticed that VarHandles that were defined as local constants inside a method were notably slower than VarHandles that were defined as static constants.

I then did a quick benchmark where I filled long arrays with random values and moved those values into appropriately sized byte arrays (i.e. with 8x the length) using these four approaches:

  1. use a static VarHandleByteArrayAsLongs.ArrayHandle
  2. use a local VarHandleByteArrayAsLongs.ArrayHandle
  3. use a static Unsafe reference
  4. use a local Unsafe reference

You can see the code here: https://pastebin.com/7ZbZKcgu

I am using the OpenJDK 26.

This is the output from the program. The units are nano seconds. I removed the memory access warnings from calling sun.misc.Unsafe::putLong. I did 2500 warmup iterations, 2500 benchmark iterations, the long arrays had a length of 1 &lt;&lt; 21 (2097152) and the byte arrays had a length of 16777216

useStaticVarHandle
min=776915, max=11360330, median=1998262, average=2072531.6216, standardDeviation=459769.1256223566

useLocalVarHandle
min=4220452, max=10941397, median=4289771, average=4334655.0888, standardDeviation=351202.1747500401

useStaticUnsafe
min=872193, max=5504646, median=1950182, average=2072433.7144, standardDeviation=337598.53310213424

useLocalUnsafe
min=860962, max=6200399, median=1944070, average=2046593.6408, standardDeviation=337197.05616648745

As you can see, the static VarHandle performed similar to the static and local Unsafe. However, the VarHandle that was defined inside a method performed worse.

Could anyone explain to me why that is or nudge me towards resources that explain it? I am rather confused because VarHandleByteArrayAsLongs.ArrayHandle, just like sun.misc.Unsafe, internally uses the jdk.internal.misc.Unsafe singleton. The Java compiler should also see that the call to get the VarHandle inside the method is always the same. Why would the static instance of the Varhandle be better optimized than the local instance inside the method? Do I need a specific setting to force more aggressive optimizations or is this an intrinsic "issue" of VarHandles?

I hope I was able to phrase my questions well enough. If you need any further information I'll be happy to provide. Thanks in advance!

reddit.com
u/Schaex — 7 days ago

Object class compiler errors in methods

I am using the Intellij compiler (if it matters) and I have a class that's really just an Object variable and an int type for me to know what type of variable the object is.

I am facing no errors by defining public Object number; or number = integer; whether or not the integer is an int, long, or BigInteger, but other methods are throwing problems. To do BigInteger.valueOf(number) the compiler asks me to cast to long like this: BigInteger.valueOf((long) number). I already know that it is a long or an int in this circumstance, that is what I'm using int type for, so is there a way to make the compiler assume a generic variable is more specific or for it to just assume the class is the correct parameter? Is there an annotation that does that or could one be made to do that? I really don't want to have to cast this variable *every time* I use it.

Yes, I am aware that I could just define multiple variables and keep most of them as null when not used, but I already went down that path and I'm trying something different.

Edit: I got advised by someone I asked irl to not use Java for this, since using a very type-heavy language while trying to get around type problems is a bad idea. I'll still try to find a java solution for this, but otherwise I'll switch to another language for what I'm trying to do.

reddit.com
u/SquibbTheZombie — 9 days ago

why use nested interfaces ?

I was reading Apache Cassandra's code base when I came across nested interfaces, now I know what an interface is but I did not understand why would you and when would you use a nested interface ?

public interface Memtable extends Comparable&lt;Memtable&gt;, UnfilteredSource, CellSourceIdentifier
{
    public static final long NO_MIN_TIMESTAMP = -1;

     interface Factory
    {
        /**
         * Create a memtable. 
...
reddit.com
u/dante_alighieri007 — 9 days ago

am i learning java the wrong way how do yall actually start making project.. confused about projects / stacks / what to even learn :(

I wanted to ask a few things but don’t really know any java devs so posting here...

I’ve been learning Java from Telusko’s Udemy course. My pace is kinda slow and I’ve done Spring Boot + web till now. I’m in 3rd year (almost ending) and still don’t really have projects.

What confuses me is how people have projects from every domain on GitHub.. AI, JS/TS, Spring Boot, random stuff. Do I actually need to learn that many stacks?

I did try making a project from a YouTube tutorial (Devtiro) but it honestly felt more like copy-pasting than actually building something myself. I want to make projects on my own, but I also need some video/reference to look at when I get stuck because I might face issues at a point.

If you’re a Java dev, what all did you learn and what kind of projects did you make? Any good channels/repos/resources for Java projects that actually help you learn instead of just copying? Also also, greeting internships is so hard for java devs.so how did u manage getting an internship??

reddit.com
u/murphzlit — 12 days ago

What the hell does Void and Return do? Examples would help.

I have my AP test in about 4 days and I am going over everything right now. Very confused on the difference between void and return and no matter how many times I search it up I’m still confused.

I know Void is used when you aren’t storing anything but what the hell does that mean? Like is void only used for print and would it even output the stuff you printed or no?

And return just outputs and runs the code that you wrote right? I think I’m just very stupid. Very cooked for the exam. I need to come to terms with getting a low exam grade because at least I have an A in the class for all three trimesters.

While we’re at it, what’s the point of static void? Usually it’s all the statics, voids, returns and stuff like that that confuses me in java. I understand statics now I think though.

reddit.com
u/MembershipOptimal514 — 11 days ago

Learned OOP from Kunal Kushwaha understood the theory but failed in interviews when asked to code. How should I actually master OOP?

i’m a 3rd year engineering student preparing for placements.

I completed Kunal Kushwaha’s OOP lectures and took detailed notes. I also used ChatGPT to understand the concepts deeply.
I thought i have learnt OOPs

however during an interview,I was asked some OOP questions,i couldd answer the theory, but when the interviewer asked me to actually design and code a solution i froze and couldnt implement it.

this made me realize that knowing OOP is very different from being able to apply OOP in real coding and interview scenarios

my goal is to reach a level where I can

Solve scenario-based OOP questions confidently,write clean OOP code in interviews,understand why certain designs are better than others,answer deeper questions like composition vs inheritance, interfaces vs abstract classes, and design trade-offs

for those who became truly comfortable with OOP ,,how did you practice?

Did you build small projects?solve design exercises?study SOLID principles and design patterns?use any specific resources or books?

what is the most effective way to move from “I know the concepts” to “I can design and code with OOP naturally under interview pressure”?

any structured roadmap,resources,or practice strategies would be greatly appreciated.

reddit.com
u/cccvvvbbbnnn4 — 12 days ago
▲ 2 r/javahelp+1 crossposts

Senior Java dev looking for a freelance

I am a senior Java backend engineer with over 10 years of experience. My main work involves APIs, databases, scripting, and automation.

I am looking for a freelance job. I'd like to work around 30-40 hours per week with predictable and sustainable income, ideally around $3000-$5000 per month.

Traditional freelance models (constantly finding clients, piecemeal projects, sales work) don't appeal to me. I'm more interested in recurring or part-time work—such as ongoing maintenance, support, internal tool development, code review, automation, mentoring, or being a "senior safety net" for a small team.

I'm struggling to answer a few questions: Is this model really viable? Or am I just daydreaming? What types of freelance work are more stable? Where do people typically find these jobs—networking, startups, agencies, job postings, or other avenues? Are there any areas suitable for senior Java developers capable of freelancing/automating/AI-assisted workflows? I would greatly appreciate any real-world experience shared.

reddit.com
u/Dry-Mechanic-5646 — 10 days ago

Question about oop encapsulation.

Let's say I have these classes:

House

HouseCatalgog- stores houses and other relevant information

SystemState- stores a HouseCatalog and other catalogs. Basically, there is an instance of this class that stores all the data my program uses and needs.

Menu - a menu class where the user can interact.

How should the menu class do something like change the name of a house from user input? Right now, it calls SystemState.changehousename(houseID, name), which then calls HouseCatalog.changehousename(houseID, name), which calls House.changename(name).

But I feel like this is C encapsulation and not correct for Java. My getters for the HouseCatalog class use a clone() so they don't return the actual pointer to houses I have stored.

Am I doing this wrong? Can I return the actual pointer from the house without breaking encapsulation, and then the Menu class just does House.changeName(name)?

reddit.com
u/migukau — 14 days ago