CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Short-Circuit Skips the Second Increment

Java code walkthrough · Question 49
mediumOperators

Code

Read carefully. What does this print?
1public class Main {
2 public static void main(String[] args) {
3 int a = 0;
4 boolean r = (a++ > 0) && (a++ > 0);
5 System.out.println(r + " " + a);
6 }
7}

Your answer