Class 1, Part 2 |
Intro to Java 30-IT-396 |
|
Comparing Multiple Statements
When comparing multiple statements...
- && returns true if the comparison before the && and
after the && both evaluate to true.
- || returns true if either the statement before the || or
the statement
after returns true.
- Performace tip: Java will stop evaluating an expression as soon
as it:
- reaches a true value in an || statement.
- reaches a false value in an && statment.
- So, put the most likely false statement first in an &&,
and the
most likely true statement first in an &&. This will save
the processor from evaluating non-necessary statements!
Constants
Advanced Topic: Ternary Operators
Advanced Topic: Bitwise Operators
Created by: Brandan
Jones January 4, 2002