CHAPTER 29 — Strings and Object References

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   go to next page        

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:

  • String literals
  • The null value
  • More about garbage
  • The String class
  • String concatenation
  • Strings are immutable
  • Some String methods
    • 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." );