DEV Community
•
2026-08-02 04:14
Java References vs Values: The Mistake That Confused Me
When I started learning object-oriented programming in Java, I hit a wall that I think a lot of beginners hit: I thought I understood how variables worked, until objects entered the picture. Here's the mistake I made and what actually clarified it for me.
The mistake
In Java, primitive types (int, double, boolean, char, etc.) work exactly how you'd expect — when you assign one variable...