revised 10/09/98; 09/04/99; 01/20/00


CHAPTER 28 — Parameters in Method Calls

An object contains both variables and methods. Often when you use a method, you need to give it some information which says what you want to happen. For example:

Point pt = new Point();
pt.move( 14, 22 );        // move pt to x=14, y=22

The move() method must be used with two parameters that give the x and y value of the new location.

Chapter Topics:

QUESTION 1:

After the following statements have executed,

String str = new String("alphabet soup");
int    len = str.length();

what value is in the variable len?