While the ternary operator is pleasingly compact, its use can make code more difficult to read. It should therefore be avoided in favor of the more verbose if/else structure.

Noncompliant Code Example

System.out.println(i>10?"yes":"no");

Compliant Solution

if (i > 10) {
  System.out.println(("yes");
} else {
  System.out.println("no");
}