Java Reference
In-Depth Information
This program generates the following output:
You can concatenate (join together) two strings using the + operator. For example, this
statement
initializes str4 with the string "OneTwoThree".
Ask the Expert
Q :
Why does String define the equals( ) method? Can't I just use == ?
A : The equals( ) method compares the character sequences of two String objects for
equality. Applying the == to two String references simply determines whether the
two references refer to the same object.
Arrays of Strings
Like any other data type, strings can be assembled into arrays. For example:
Search WWH ::




Custom Search