created: 6/15/1998; revised: 09/05/1999, 06/12/2000, 05/04/2002, 01/19/2006, 06/15/2008
CHAPTER 29 — Strings and Object References
In previous chapters,
methods were called with parameters
that were primitive data types.
This chapter discusses how to use object references
as parameters.
The class String is used in many examples.
Chapter Topics:
Stringliterals- The
nullvalue - More about garbage
- The
Stringclass StringconcatenationStrings are immutable- Some
Stringmethods- concat()
- length()
- trim()
- substring()
- toLowerCase()
- startsWith()
- charAt()
- Cascading methods
Students taking the computer science Advanced Placement examination
are expected to be familiar with the String class.
QUESTION 1:
(Review:) What TWO things does the following statement do?
String zeta = new String( "The last rose of summer." );