新手学java

用了Scanner这个类名,试着用一下

import java.util.Scanner;

public class ScoreJudge {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入成绩:");
        int score = sc.nextInt();
        
        System.out.println(score >= 60 ? "及格" : "不及格");
        
        sc.close();
    }
}

但要注意
先写import
注意大写S

posted @ 2026-04-12 00:07  王不留情  阅读(2)  评论(0)    收藏  举报