📜  java 一行 if else - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:32.544000             🧑  作者: Mango

代码示例1
statement ? true     :     false
  ^          |     ^              ^
condition |   (instruction)
            |  If the statement:  
            |    is true | is false
--------------------------------------------------------------------------------
 Example:
int i = 10;

String out = i > 8 ? "Bigger than Eight!" : "Smaller than Eight!";
System.out.println(out);