Java Reference
In-Depth Information
HelloWorld can use this new method to request a return message that is all
uppercase.
tempMsg = myErrorMsg.getErrorMsg ('U');
System.out.println (tempMsg);
Hello applet World!
Some Text
Some New Text
Some Text for #2
Some New Text
SOME NEW TEXT
H ELLO W ORLD : T HE A PPLICATION
public class HelloWorld {
public static void main(String args[]) {
String tempMsg;
// Our original println statement:
System.out.println("Hello World!");
// Create a new instance of the ErrorMsg class.
ErrorMsg myErrorMsg = new ErrorMsg ();
// Get the value of the text item in ErrorMsg by calling the
// getErrorMsg method.
tempMsg = myErrorMsg.getErrorMsg ();
// Print the contents of the String returned by this method.
System.out.println (tempMsg);
// Set the text item in ErrorMsg to some text String, and print its
// contents:
myErrorMsg.setErrorMsg ("Some Text");
tempMsg = myErrorMsg.getErrorMsg ();
System.out.println (tempMsg);
// Call the setErrorMsg method again to setErrorMsg to some other text.
myErrorMsg.setErrorMsg ("Some New Text");
tempMsg = myErrorMsg.getErrorMsg ();
System.out.println (tempMsg);
Search WWH ::




Custom Search