SomeClass classvar = new SomeClass(); --> Object classvar = new SomeClass(); --> Object 2 So what I understand about JAVA is that , in the first line, classvar object of SomeClass is created. In the next line, there is another object created of classvar.
My Question - What will be changed here? Will the reference of classvar object be updated due to second line ORR the object created in line 1 will be garbage collected?
EDIT: adding code tags
SomeClass classvar = new SomeClass(); classvar = new SomeClass();?