created: 06/12/2008; revised 07/20/2014, 08/05/2017

go to home page   go to next page

CHAPTER 45 — More about Strings

Chapter Topics:

String objects are frequently used in programs. This chapter provides extra practice in using them.

Note: the String class is one of the classes that Advanced Placement Computer Science students are expected to know well. This chapter was written after the author observed an unfortunate number of mistakes involving Strings in the AP-CS 2008 examination.


QUESTION 1:

What does the following code write?

public class ImmDemo
{
  public static void main ( String[] args )
  {
    String str = new String("I recognize the vestiges of an old flame.");
    str.substring( 16 );
    System.out.println( str );
  }
}

go to home page   go to next page