黑马程序员技术交流社区

标题: 请帮我看看这个代码除了哪里错了 [打印本页]

作者: wuzeshui    时间: 2016-1-14 22:02
标题: 请帮我看看这个代码除了哪里错了
public class test6 {
        public static void main(String[]args){
                System.out.println("Please enter an No.");
                Scanner scanner=new Scanner(System.in);
                int score=scanner.nextInt();
                switch (score) {
                case 5:
                System.out.println("very good");
                break;
                case 4:
                System.out.println("good");
                break;
                case 3:
                System.out.println("not good");
                break;
                case 2:
                case 1:
                System.out.println("bad");
                break;
                default:
                System.out.println("the input method is not right");
        }        
        }
}
为什么运行不下去呢,编译好像没错。。。
而且显示的是错在switch(score)那一行

作者: xhao327    时间: 2016-1-15 01:23
在最前面 public class test6 的前面 插入   import   java.util.Scanner;
作者: wangchuankun1    时间: 2016-1-15 09:17

楼上说得对
作者: 酱油    时间: 2016-1-15 13:37
没导包、、、import java.util.*;
作者: hei930923    时间: 2016-1-15 14:15
ctrl+shift+o就可以直接导包了哦
作者: fury1994    时间: 2016-1-15 15:59
导包~~~~~~~~~~~~~~




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2