Java Reference
In-Depth Information
At the end of a method, print out the return value:
public double getTax()
{
. . .
Logger.global.info("Return value = " + tax);
return tax;
}
The Logger class has many other options for industrial-strength logging. Check
out the API documentation if you want to have more control over logging.
215
216
CHAPTER SUMMARY
1.
The if statement lets a program carry out different actions depending on a
condition.
2.
A block statement groups several statements together.
3.
Relational operators compare values. The == operator tests for equality.
4.
When comparing floating-point numbers, don't test for equality. Instead, check
whether they are close enough.
5.
Do not use the == operator to compare strings. Use the equals method
instead.
6.
The compareTo method compares strings in dictionary order.
7.
The == operator tests whether two object references are identical. To compare
the contents of objects, you need to use the equals method.
8.
The null reference refers to no object.
9.
Multiple conditions can be combined to evaluate complex decisions. The
correct arrangement depends on the logic of the problem to be solved.
10. The boolean type has two values: true and false .
11. A predicate method returns a boolean value.
Search WWH ::




Custom Search