When I use the OR operator, only one expression has to be true. Is the first if statement more efficient because java checks only the first expression? Or does java check both?
public class Test {
public static void main(String args[]) {
boolean test = true;
if (test || calculate()) {
// do something
}
if (calculate() || test) {
// do something
}
}
public static boolean calculate() {
// processor-intensive algorithm
}
}