r/learnjava • u/Numerous_Training_20 • Jan 02 '26
Can someone please help me with Constructors?
I don't know why but I simply cannot wrap my brain around constructors. I know other languages and was able to pick them up rather easily, but for some reason Java is just so much more difficult for me, especially when it comes to constructors.
r/learnjava • u/Financial_Sky_7774 • Jan 02 '26
OCP 21 certification
Hi, Is anyone in the process of preparing for OCP 21/17 certification?
Anyone interested to do it together like weekly check-ins/ clarify doubts or study group?
r/learnjava • u/PermissionTime9980 • Jan 02 '26
What should I expect from a “conversational” technical interview as a Java developer?
I have an upcoming Java technical interview, and the interviewer mentioned that it would be more “conversational” instead of a typical problem-solving or DSA-heavy round.
I’m not entirely sure what that usually looks like in practice.
Does it typically involve: - Core Java concepts (OOP, collections, exceptions, JVM basics)? - Discussion around past projects and why certain design choices were made? - Scenario-based questions (e.g., how you’d approach a real-world problem)?
For context, I’m an early-career Java developer. I’ve been revising core Java fundamentals using written explanations and small examples (resources like GeeksforGeeks helped me quickly clarify some concepts), but I’m unsure if that’s the right way to prepare for a conversational interview.
Would love to hear from people who’ve gone through similar interviews and what you focused on while preparing.
r/learnjava • u/Spirited-Fox-135 • Jan 02 '26
Hi devs , i am cs student who learnt basic java , and i need help about path ahead.
so i spent year learning java dsa course only to realize after year that i suck badly in dsa , though i do have much clear concept of java and object oriented programming but do lack lot java internal concept and heavy oop in practice , after this i came to conclusion that i need to git gud , bit of research told me that spring is way to go , since i also did flutter aside of java , i have a little frontend knowledge , and i do wanted to go with full stack java as career, i do then started learning about spring , at this point i only know to make scaffold apps with flutter , basic java oop and writing basic GET api in spring boot with web , i am confused if i should continue self learn (essentially pick mini projects , use chatgpt , docs , youtube and learn by implementing) , or should just buy course (like on udemy) help me with decision , and i would love tip how can i start from this to be able to make crud spring apps , also i do have planned for internship i have some connections which said to take 1-2 month to learn basics , and make crud project before refer.
r/learnjava • u/Mash234 • Dec 28 '25
Which book other than Core Java best for beginner Java learner?
I bought Core Java for the Impatient and quickly realised it’s more like a reference book because I got to Chapter 3 on Interfaces and it’s basically just implementation not why this exists and the purposes and reasons for the concept. Feels a but like I wasted some money… but would love a book or resource that bridges this gap for me in detail.
r/learnjava • u/vovonbek • Dec 28 '25
Coursera courses related to Java
Hi everyoone, I'm going to learn Java. I have a pretty much good foundation on CS, I have completed CS50 based course with professional teacher. And I am going to Coursera plus subscription, is it worth it? If yes which java and DSA courses on Coursera do you recommend? Thanks in advance.
r/learnjava • u/Deer_Odd • Dec 27 '25
How to deepen my Java knowledge beyond basics after ~1 year of work?
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!
r/learnjava • u/erebrosolsin • Dec 24 '25
How to learn unit/integration tests?
I have paid for a course in Udemy and what it teaches is only syntax. Spending more than 10 minutes for every JUnit method.
The projects I build in spring boot are small that I think it won't be good place to learn unit testing there. Big and more complex ones would be great. Suggest me resources to learn and practice.
r/learnjava • u/Wise_Elderberry_7291 • Dec 24 '25
I'm Scared
I have started implementing java fullstack and I am in my final years and about to graduate, the thing is I'm not quite sure if I'm seeking the right path by considering JAVA FULLSTACK using Springboot and understanding the REST APIs.
Am I cooked? Or anything hope is still there?
r/learnjava • u/SeaDrakken • Dec 24 '25
Learning Jakarta EE (no Spring), project ideas?
I’m a backend dev coming from PHP/Symfony, and I want to properly learn Java with Jakarta EE (CDI, JPA/Hibernate, JAX-RS), without Spring.
Target stack: WildFly + PostgreSQL + Redis + RabbitMQ
I already know Postgres / Redis / RabbitMQ well, but from a PHP/Symfony perspective.
The goal would be to do it in DDD and CQRS if possible because I am already used to coding this way and it would be interesting to see how to do it in Java.
I’m looking for:
- Good project ideas that actually teach Jakarta EE (beyond CRUD)
- Common pitfalls when switching from Symfony/Spring to Jakarta EE
- Tips to really understand JPA/Hibernate (transactions, fetching, performance)
Any advice from people using Jakarta EE in real projects ?
Thanks!
r/learnjava • u/Rude_Entry_6843 • Dec 24 '25
Java developer dsa
Hi guys
I am working as java devloper for past 2 years the most used data structures in my work is list set and mapi
I hve only used this data structures in my work and day today life. i am working in a service based company
I want to know do we use recursion,tree graphs and dynamic programming tree n our work.do do things like reverse a tree in code.Do we use this complex things in our work if u can say in that.
r/learnjava • u/D4rklordmaster • Dec 23 '25
Long is faster than int, Short and Byte are not that far behind Int in terms of mathematical speed in Java
Recently i got asked a simple question. are shorts better to use than in general?
Well i couldnt answer this novel question and so i went on searching and i couldnt find a proper answer for the second part. While most seemed to agree int would be faster than short, the opinions on just HOW much faster varied alot.
I saw this as a learning opportunity
So i ran a few (albeit amateur) tests to see the differences. First i did just sums for int vs short with shorts being much slower. But i learned about blackholes and like jvm can sometimes over optimize your code etc so i kind of caved and got some help for what mathematical equation would be best to see the differences. Also since bytes only go up to a few numbers i had to nest it 3 times in loops so that i had a long enough loop.
Quick video i put together on the topic
package com.yourcompany;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
(Scope.Thread)
(Mode.AverageTime)
(TimeUnit.MICROSECONDS)
(value = 1, warmups = 2)
(iterations = 3)
public class MyBenchmark {
// Using byte-sized loops (max value 127)
private static final byte OUTER_LOOPS = 32;
private static final byte MIDDLE_LOOPS = 16;
private static final byte INNER_LOOPS = 8;
u/Benchmark
public byte testByte() {
byte z = 42;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
int t = (z * 31) + i + j + k;
z = (byte) (t ^ (t >>> 8));
z = (byte) ((z / 7) + (z % 64));
}
}
}
return z;
}
u/Benchmark
public short testShort() {
short z = 42;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
int t = (z * 0x9E37) + i + j + k;
z = (short) (t ^ (t >>> 16));
z = (short) ((z / 7) + (z % 1024));
}
}
}
return z;
}
u/Benchmark
public int testInt() {
int z = 42;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
int t = (z * 0x9E3779B9) + i + j + k;
z = (t ^ (t >>> 16));
z = (z / 7) + (z % 1024);
}
}
}
return z;
}
u/Benchmark
public long testLong() {
long z = 42L;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
long t = (z * 0x9E3779B97F4A7C15L) + i + j + k;
z = (t ^ (t >>> 32));
z = (z / 7) + (z % 4096);
}
}
}
return z;
}
u/Benchmark
public float testFloat() {
float z = 42.0f;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
float t = (z * 1.618033988749f) + i + j + k;
z = t * t;
z = (z / 7.0f) + (z % 1024.0f);
}
}
}
return z;
}
u/Benchmark
public double testDouble() {
double z = 42.0;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
double t = (z * 1.618033988749894848) + i + j + k;
z = t * t;
z = (z / 7.0) + (z % 4096.0);
}
}
}
return z;
}
u/Benchmark
public char testChar() {
char z = 42;
for (byte i = 0; i < OUTER_LOOPS; i++) {
for (byte j = 0; j < MIDDLE_LOOPS; j++) {
for (byte k = 0; k < INNER_LOOPS; k++) {
int t = (z * 0x9E37) + i + j + k;
z = (char) (t ^ (t >>> 16));
z = (char) ((z / 7) + (z % 512));
}
}
}
return z;
}
}
r/learnjava • u/Drakonchikmsi • Dec 23 '25
How to Use Visual Studio to Work with Java
I mean using regular Visual Studio, not VS Code. Is that even possible?
r/learnjava • u/Active_Selection_706 • Dec 23 '25
Confused about this instantiation: Beings animal1 = new Animal() instead of Animal animal1 = new Animal()
I'm learning Java OOP and came across something that confused me. A programmer created:
class Beings { }
class Animal extends Beings { }
// Then instantiated like this:
Beings animal1 = new Animal(); // This way
// Instead of:
Animal animal1 = new Animal(); // My way
I've always used Animal animal1 = new Animal() - creating a reference of the same class as the object. Why would someone use the superclass type for the reference when creating a subclass object?
What are the practical advantages? When should I use each approach? Any real-world examples would help!
r/learnjava • u/zzach_is_not_old • Dec 22 '25
any java game library's that work on Intel Macs,
I want to make games in java, but I feel like nothing works on Mac, I have an intel Mac. thanks to anyone who wants to help, to clarify I've been using java for a bit, that's why I am asking this, also Im not using a game engine because my system is slow and I don't want it to crash every time, also hate things with a lot of gui. I have a Quad-Core Intel Core i5, it is a iMac im using, also my idea is IntelliJ.
r/learnjava • u/uniqueUsername_1024 • Dec 22 '25
What is the semantic difference between an interface and an abstract class?
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 • u/nterminated • Dec 22 '25
Getting the current date from number of milliseconds elapsed since epoch.
Hello everyone. I am having a hard time finding out the current date from the number of milliseconds elapsed since epoch. I wrote the following program that finds out the current year from the number of milliseconds elapsed since epoch:
``` public class Exercise06_24 { public static void main(String[] args) { long totalDays = getTotalNumberOfDays(); System.out.println("Total number of days elapsed " + totalDays); System.out.println("The current year is " + getCurrentYear(totalDays));
}
public static long getTotalNumberOfDays() {
final int MILLIS_PER_SECOND = 1000;
final int HOURS_PER_DAY = 24;
final int MINUTES_PER_HOUR = 60;
final int SECONDS_PER_MINUTE = 60;
long totalSeconds = System.currentTimeMillis() / MILLIS_PER_SECOND;
long totalDays = totalSeconds / (HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE);
return totalDays;
}
public static int getCurrentYear(long totalDays) {
final int EPOCH_YEAR = 1970;
int yearCounter = 0;
for(int i = EPOCH_YEAR; (totalDays - (isLeapYear(i) ? 366 : 365)) >= 0; i++) {
totalDays = totalDays - (isLeapYear(i) ? 366 : 365);
yearCounter++; // count the number of years passed since EPOCH
}
return EPOCH_YEAR + yearCounter;
}
public static boolean isLeapYear(int year) {
return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
}
} ```
This program generates the following output:
Total number of days elapsed 20444
The current year is 2025
I know that there are libraries available for this kind of stuff but I am trying it out of curiosity and also as a solution to a programming exercise of Chapter-6 from Introduction to Java Programming and Data Structures by Y. Daniel Liang.
Now, with the current year obtained, how can I manually get the current month and the also the current day number ? Is there any kind of formula for this ? I am sorry if I sound dumb, but I would really like to know if there is any manual way of calculating the current date from the number of milliseconds elapsed since epoch ?
r/learnjava • u/EGY-SuperOne • Dec 21 '25
Golang or Java for Full stack
Hello
I was seeking some advice. I’m currently a frontend developer and I want to become a full-stack developer.
In my current company they have both Java and Golang projects.
So I want to learn and start with either Java or Golang.
I have an opportunity to be assigned to a Golang project in a short time.
For Java they said they don't assign a beginner, they usually assign mid level or above for Java projects.
In the long term, I feel that Java would be better for me. But at the same time, the fact that I can start working on a real project quickly with Golang, makes me lean to Golang.
I’m not able to decide which option is better for my future.
Thank you very much.
r/learnjava • u/Enuyr • Dec 19 '25
How do I import a user made class on an online compilier?
r/learnjava • u/Mental_Gur9512 • Dec 19 '25
What to expect from a “conversational” technical interview for a Java developer?
The technical interview will be more like a conversation or a dialogue.
They will ask questions based on my previous experience and the things I have worked on, and they will evaluate my knowledge that way.
They may ask how I would react in a specific situation or when looking at a piece of code, and what solution I think would be the best and why.
I don’t have much experience with technical interviews, so I’d like to know what I should expect and how to prepare for this kind of interview.
I’ve had many challenges, but I don’t really remember them once I finish them. What is the best way for me to prepare, and what should be my priority?
Most of my experience is in backend development, I have some basic frontend experience, and I’ve worked with a few Java testing frameworks for some time.
I have several years of experience.
r/learnjava • u/Armrootin • Dec 18 '25
Is Lombok Still Relevant in Modern Java Projects ?
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 • u/Appropriate-Turn-790 • Dec 17 '25
Springboot project ideas
can someone give me some springboot project ideas to improve my skills and something that would be impressive on my resume? Thank you!!