All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.S1774.html Maven / Gradle / Ivy

While the ternary operator is pleasingly compact, it's 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");
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy