超类:
public class CwDB{
protected LinkedList<Entry> dict = null;
public CwDB(String filename){
this.dict = new LinkedList<Entry>();
try{
FileReader fr = new FileReader(filename);
BufferedReader br = new BufferedReader(fr);
String w = null;
while((w = br.readLine()) != null ){
String c = br.readLine();
this.add(w,c); //adds new Entry to dict
}
br.close();
fr.close();
}catch(IOException e){
e.printStackTrace();
}
}
public void add(String word, String clue){
this.dict.add(new Entry(word,clue));
}
...
}
子类:
public class InteliCwDB extends CwDB {
public InteliCwDB(String filename){
super(filename);
}
}
情况1:
CwDB db = new CwDB("src/cwdb.txt");
案例二:
InteliCwDB idb = new InteliCwDB("src/cwdb.txt");
问题是案例 1 完美地工作,但案例 2 根本没有。你能告诉我有什么问题吗?(我没有得到任何错误/异常,只是 idb 的列表是空的,当 db 的列表有 ober +1k 元素时......)