CJCoding With Joseph
← Back to Question List
Java Code Walkthrough #49

Short-Circuit Skips the Second Increment

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