程序分析:(a b)?a:b这是条件运算符的基本例子。 package procedure;import java.util.Scanner;public class Score {private static Scanner scanner;public static void main(String[] args) {scanner = new Scanner(System.in);System.ou
package procedure; import java.util.Scanner; public class Score { private static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); System.out.println("请输入分数x:"); int x = scanner.nextInt(); char n = (x >= 90) ? 'A' : (x >= 60) ? 'B' : 'C'; //一次定义类型:n和A,B,C。 System.out.println(n); } }