Syntax Quiz 2, Step 12

Assignment:

Write an expression to find the length of the string stored in the variable theParameter.

My solution:

theParameter.length()

Common mistakes:

Putting theParameter inside the parentheses.
The length() method is part of the built-in String class, so it is called with a String (like theParameter) in front of the period, then the method name, then parentheses around the (lack of) remaining arguments.

Stephen Bloch / sbloch@adelphi.edu