Why is this equality to another object check in String.java? -
in string.java, code @ beginning of .equals() method:
public boolean equals(object anobject) { if (this == anobject) { return true; } // ... check if instance of string, etc. } is check purely performance reasons (i.e. not including check characters of this against itself)?
yes, is. since references same object, it's they're equal.
string = "foobar"; a.equals(a) // true
Comments
Post a Comment