JavaSyntax
Ternary Operator
Code example
String s = ok ? "yes" : "no";Picks one of two values in one line.
In Java, ternary operator: picks one of two values in one line — String s = ok ? "yes" : "no";
String s = ok ? "yes" : "no";String s = ok ? "yes" : "no";Picks one of two values in one line.
Use String s = ok ? "yes" : "no";.
Use this pattern: String s = ok ? "yes" : "no";
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.