Java Reference
In-Depth Information
Compile and rerun the HelloWorld application. The output should look
like this:
...
testMsg = ErrorMsg.text
i = 5
z = 5
11. Add the parentheses as indicated here.
z = (x + 1) * 2;
System.out.println ("z = " + z);
Compile and rerun the HelloWorld application. As you would expect, the
value of z is different. The output should look like this:
testMsg = ErrorMsg text
i = 5
z = 8
12. You'll explore how to use the Java operators to control evaluations. Add
these bolded lines to the end of your HelloWorld java source file:
// Experiment with operators
if (((x == y) || (z < x)) && ((z != y) || (x >= 1))) {
System.out.println ("Condition is true");
}
else {
System.out.println ("Condition is not true");
}
Compile and rerun the HelloWorld application. The output should look
like this:
...
testMsg = ErrorMsg text
i = 5
z = 8
Condition is not true
Compare the previous Java statements to this COBOL sentence:
Search WWH ::




Custom Search