Rewrite the following using ternary operator: if (x % 2 ==
Rewrite the following using ternary operator:
if (x % 2 == 0) System.out.println("Even"); else System.out.println("Odd");
101 Likes
System.out.println(x % 2 == 0 ? "Even" : "Odd");
Answered By
62 Likes