|
After the following statements have executed,
what value is in the
variable len?
A good answer might be:13. (Remember to count the space character.) |
Parameter-less MethodsLook again at the method call (the second statement, which uses "dot notation" to specify the method.)
The second statement contains a method call. This is a request to run one of the methods of a particular object. The object referenced by str contains a method length() which when called returns the number of characters in the string. The length() method does not require any parameters. The parameter list in the method call str.length() is empty. |
QUESTION 2:What is wrong with the following code segment? Click Here after you have answered the questionPoint myPoint = new Point(); // construct a point at x=0, y=0 myPoint.move(); // move the point to a new location |