String a = "test";
why is "test".equals(a) true?
does the "test" in "test".equals(a) get the same reference as a from the string pool? Thanks
String a = "test";
why is "test".equals(a) true?
does the "test" in "test".equals(a) get the same reference as a from the string pool? Thanks
equals for String does not do a reference compare, does a value one.
For other classes you create, if you dont override equals and hashcode, it will do a reference compare, otherwise it will call your override.