Java Reference
In-Depth Information
Hello World!
Some Text
Some Text
msgSize 9
interface G
counter 3
Some New Text
Some Text for #
Some New Text
SOME NEW TEXT
msgSize 13
interface G
counter 7
16. For the next experiment, you will examine the behavior of local variables
and observe how they are different from class variables. Add the bolded
lines of code to the setErrorMsg method and the first getErrorMsg method
so that they look like this:
// Define a public method.
public void setErrorMsg (String inputMsg) {
// Define a local variable and increment it.
int localCounter = 0;
localCounter = localCounter + 1;
// Modify some of the private variables.
counter = counter + 1;
interfaceInUse = 'S';
. . .
// Define another public method.
public String getErrorMsg () {
String returnMsg;
// Define a local variable and increment it.
int localCounter = 0;
localCounter = localCounter + 1;
// Modify some of the private variables.
counter = counter + 1;
interfaceInUse = 'G';
}
17. Add the bolded lines of code to the end of ErrorMsg :
Search WWH ::




Custom Search