Java Reference
In-Depth Information
// Define another public method.
public String getErrorMsg () {
String returnMsg;
// Set the local variable returnMsg to the data member msgText.
returnMsg = msgText;
// Return from this method, and return this String variable.
return (returnMsg);
}
// Define a variation on the public method getErrorMsg.
public String getErrorMsg (char caseFlag) {
String returnMsg;
// Set the local variable returnMsg to the data member msgText.
returnMsg = msgText;
// Convert to all uppercase, if requested.
if (caseFlag == 'U')
returnMsg = returnMsg.toUpperCase ();
// Return from this method, and return the String variable.
return (returnMsg);
}
}
Search WWH ::




Custom Search