CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #10

Ternary Operator Chain

mediumIf Statements

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 int a = 5, b = 10, c = 3;
4 int max = (a > b) ? (a > c ? a : c) : (b > c ? b : c);
5 System.out.println(max);
6 }
7}

🎯 Your Answer