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

Ternary Operator Chain

Java code walkthrough · Question 10
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