From what I have learned, the class objects in Java are actually references to those objects. An object itself cannot have a variable, only a reference to it.
Consider the following C++ example :
SomeClass A(5);
SomeClass &B = A;
SomeClass &C = B;
Now, I think I'm right in saying that all of the three statements below will use the exact same object :
A.someMethod(); //some object
B.someMethod(); //the same object
C.someMethod(); //the same object
However, in Java, although objects are actually references, using the assignment operator will create an entirely new object with a new reference to it.
SomeClass A = new SomeClass();
SomeClass B;
B = A;
Now, the method calls will call from entirely different objects :
A.someMethod(); //uses one object
B.someMethod(); //uses entirely different object
Please tell me whether I am right or wrong.