PaycomOA #19
Q19. Java Boolean Short-Circuit
Estimated EasyConcept questionStatement and editorial — judging is being prepared
Topics (AI-labelled)Bits & Math
What will be the output of this Java program?
class SSBool {
public static void main(String[] args) {
boolean b1 = true, b2 = false, b3 = true;
if (b1 & b2 | b2 & b3 | b2) // Line 8
System.out.print("ok ");
if (b1 & b2 | b2 & b3 | b2 | b1) // Line 10
System.out.println("dokey");
}
}
- ok / dokey <- / ok dokey / compilation fails
Line 8 evaluates to false (no ok); line 10 ends with | b1 which is true, so dokey prints.
Editorial
Loading solution…