(Review:) What two things does the following statement do?
String zeta = new String( "The last rose of summer" );
Stringobject is created, containing the characters between quote marks.
String objects are very useful and are frequently used.
To make life easier for programmers
Java has a
short-cut way of creating a
String zeta = "The last rose of summer" ;
This creates a
String object containing the
characters between quote marks.
String created in this short-cut way is called
a String literal.
Remember that if several statements in a program ask for literals
containing the same characters only one object will actually be constructed
(see chapter 41).
Other classes do not have short-cuts like this.
Objects of most classes are constructed
by using the
String reference be a parameter for a method?