class ErrorList {
private List list = new ArrayList();
public void add(int Line, int Column){
list.add(new Integer(Line));
list.add(new Integer(Column));
}
public Integer get(int i){
return (Integer)list.get(i);
}
public int sizeof(){
return list.size();
}
}
public class XXX{
ErrorList printError = new ErrorList();
....
printError.add(x, y);
}
为什么编译后会出现 CompilerTest.java:105: unreachable statement
printError.add(x, y);
这样的错误呢??其他容器也是这样的问题.
private List list = new ArrayList();
public void add(int Line, int Column){
list.add(new Integer(Line));
list.add(new Integer(Column));
}
public Integer get(int i){
return (Integer)list.get(i);
}
public int sizeof(){
return list.size();
}
}
public class XXX{
ErrorList printError = new ErrorList();
....
printError.add(x, y);
}
为什么编译后会出现 CompilerTest.java:105: unreachable statement
printError.add(x, y);
这样的错误呢??其他容器也是这样的问题.
可能由于程序在前面返回了或其他原因导致执行不到这句话
仔细查yixia