1//ternary operator
2// takes in a conditional statement
3// a is returned when the condition is true and vice versa
4return (a == b) ? a : b;
5
6int n = (a < b) ? a + 10: b;
1boolean statement ? true result : false result;
2
3/*
4For example, if we take this if statement:
5*/
6if (a > b) {
7 result = x;
8} else {
9 result = y;
10}
11// can be also writen:
12result = a > b ? x : y;