go to previous page   go to home page   go to next page hear noise highlighting

Answer:

No. The example program called the method like this:

str.length();

No parameters are supplied, but the two parentheses are required.


Declaring a Reference Variable

There are several ways to declare a reference variable:

ClassName variableName;
ClassName variableName  =  new ClassName( parameter, parameter, ... ) ;
ClassName variableNameOne, variableNameTwo ;
ClassName variableNameOne  =  new ClassName( parameter, parameter, ... ), 
          variableNameTwo  =  new ClassName( parameter, parameter, ... ) ;

QUESTION 12:

Is the following correct?

String stringG = new String("You know my methods, Watson.");

go to previous page   go to home page   go to next page