1 2 3 public class Demo08 { 4 public static void main(String[] args) { 5 //x ? y : z 6 //如果x==true,则结果为y,否则结果为z 7 8 int score = 50; 9 String type = score < 60 ? "不及格":"及格"; 10 System.out.println(type); 11 } 12 }