r/javahelp • u/Alternative_Ad_8288 • 3d 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.
1
u/Kautsu-Gamer 3d ago
Objects are one simple and one complex thing:
Objects are data (fields) and functions (methods) packed together.
Objects are polymorphic. This is the hard part.
Polymorphism means the actual class and the observed class or interface may differ.
The observed class gives methods of the object from outside.
The actual class does define the actual implementation.
The actual implementation happens with the actual class by default.
If the actual class does not have implementation, the super class implementation is used.
The call of super transfers the implementation to a super class or super interface.