...in other words: let's suppose I have 2 Strings declared as so:
String one = new String("yay!");
String two = new String("yay!");
these two Strings are two different objects, but if I run
if(one.equals(two))
System.out.println("equals() returns true.");
I get "equals() returns true". This is because the String class overrides the equals() method to implement a content level equality. However, I need to access a reference level equality (like the one implemented in Object) to distinguish the object one form the object two. How can I do that?
I tried this:
one.getClass().getSuperclass().equals();
to try to invoke the Object equals() method of the String one but it didn't work.
Any advice?