Say I set int A = int B. When I change A after, it will not change the value of B. But when I set a SomeClass A = SomeClass B, and I change A\'s contents (like a.cost), it c
In java when you assign Object to Object its assign by reference. Int is non an Object in java so when you assign int to int its assign by value.