Testing Strings for Equality

Strings are Objects in Java, but the ability to use literals, along with the String concatenation operator, make them somewhat similar to primitive types. Java also automatically “interns” String literals, meaning that a single String object will be created for a literal that is used multiple times. “String Equality and Interning” describes the effect of interning on String equality testing using the == operator and the equals(Object) method.

28 January 2004 | Basics | Comments

Comments are closed.




Copyright 2003-2016 - Philip Isenhour - All code samples may be freely used under the MIT Open-Source License