首页 > 试题广场 >

下面代码中有什么错误?

[问答题]
 下面代码中有什么错误?


1、小于60.0,输出F
2、大于90,也只会输出D
public static void main(String[] args) {
        double score = 90;
        if (score >= 60.0)
            System.out.println("D");
        else if (score >= 70.0)
            System.out.println("C");
        else if (score >= 80.0)
            System.out.println("B");
        else if (score >= 90.0)
            System.out.println("A");
        else
            System.out.println("F");
    }


发表于 2021-05-21 15:45:52 回复(0)
判断的时候先判断>=90,再80 70 60 60以下
发表于 2019-09-10 16:37:50 回复(0)