r/javahelp • u/Alternative_Ad_8288 • 9d ago
Java Beginner – Struggling with OOP and Understanding Stack and Heap
Hi everyone!
I’ve been learning Java for a few weeks now, and I’m starting to get into OOP. However, I’m finding it difficult to fully understand some of the core concepts, especially how objects work and the difference between the stack and heap memory.
I don’t want to just memorize definitions. I want to actually understand what’s happening behind the scenes and how everything connects.
For those of you who have been through the same learning process:
What helped you understand OOP?
How did you learn the difference between stack and heap?
Are there any resources, exercises, or learning methods you would recommend?
I’d really appreciate any advice from more experienced Java developers.
View all comments
Show parent comment
1
u/Jamarlie 9d ago
I second this as well. I know this is something people here do not like to hear, but Java is a bad first programming language in general. It was never designed to be a good beginner language either. You effectively have the entire concept of classes bolted onto every core principle you work with so you will always need to do more. And while I specifically recommend it here in this situation, entirely ignoring the Stack vs. Heap is also not really the most ideal construct. It also has some amount of impact within the JVM, though to a much lesser extend. The parts where it does matter can come back to bite you though, like constant object creation with an Integer vs primitive int array.
That's why I personally do not feel like recommending higher level languages like Java to beginners is worthwhile. Beginners need to focus on learning core concepts and fundamental ideas. You don't teach a 1st grader the basics of addition by letting them do point additions on elliptic curves either. This feels very analogous to that.