黑马程序员技术交流社区
标题:
缺少返回语句
[打印本页]
作者:
史晓霞
时间:
2011-11-2 11:45
标题:
缺少返回语句
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;
}
作者:
fso918
时间:
2011-11-2 12:21
第一个无参方法没有返回值;
return getStudents(null);
作者:
史晓霞
时间:
2011-11-2 12:44
调用的方法里不是有返回值吗,有return,我看视频老师也没有写,不写不行吗?
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2