/* shows how short-circuiting works */ public class shortcircuit { public static void main(String[] args) { int intVar = 2; // This enters testMethod and tests the entire conditional if( (testMethod()) && (intVar <= 1) ) { System.out.println("Successful test 1."); } // This shortcircuits before it gets to testMethod if( (intVar <= 1) && (testMethod()) ) { System.out.println("Successful test 2."); } // You can also shortcircuit OR logic if( (intVar == 2) || (testMethod()) ) { System.out.println("Successful test 3."); } } public static boolean testMethod() { System.out.println("Entered testMethod()."); return true; //return false; } }