A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 史晓霞 黑马帝   /  2011-11-2 11:45  /  2012 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

E:\CSDN\Notes\practice\code\IO>javac StudentInfoTest.java
StudentInfoTest.java:65: 缺少返回语句
        }
        ^

public static Set<Student>  getStudents()throws IOException
        {
             getStudents(null);

        }
       
       
        public static Set<Student>  getStudents(Comparator<Student> com)throws IOException
        {
                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

                byte[] by=new byte[1024];

                String line=null;
                Set<Student> stus = null;
                if(com==null)
                        stus=new TreeSet<Student>();
                else
                        stus=new TreeSet<Student>(com);
               
               
                while((line=br.readLine()) !=null)
                {
                        if("over".equals(line))
                                break;
                        String[] info=line.split(",");
                        Student stu=new Student(info[0],new Integer(info[1]),new Integer(info[2]),new Integer(info[3]));
              stus.add(stu);
                }
                br.close();
        return stus;
        }

2 个回复

倒序浏览
第一个无参方法没有返回值;
return getStudents(null);
回复 使用道具 举报
调用的方法里不是有返回值吗,有return,我看视频老师也没有写,不写不行吗?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马