Java Reference
In-Depth Information
inputMsg = myErrorMsg.getErrorMsg ()
Placing a semicolon at the end makes it a complete Java statement:
inputMsg = myErrorMsg.getErrorMsg ();
This is a Java statement that compares inputMsg to another String and per-
forms some logic. Since inputMsg is a String , it has a method called equals() , which
accepts a String parameter and returns a boolean true or false . The if construct
tests the boolean result of this method and performs the statements in the braces if
the result is true:
if (inputMsg.equals ("Any Text")) {
...
}
Expressions can be combined into more complex Java statements:
String inputMsg = myErrorMsg.getErrorMsg ();
or this statement:
if (myErrorMsg.msgText.equals ("Any Text")) {
...
}
J AVA C OMMENTS
Java programmers are expected to place comments in the code. Imagine that! To
support this, Java allows for the following comment styles:
Style
Format
Comments
C comments
/* . . . */
Can span multiple lines
C++ comments
//
Stops at end of line, avoids some common errors in C
Javadoc comments
/** . . . */
Used to autogenerate external documentation
 
Search WWH ::




Custom Search