本帖最后由 achilles 于 2012-7-14 16:25 编辑
public static void main(String[] args) throws IOException
{
// TODO Auto-generated method stub
FileReader r = new FileReader("乱七八糟.txt");
MyBufferedReader myBuf = new MyBufferedReader(r);
String line = null;
while((line = myBuf.myReadLine()) != null); //你这里加了个;下面的那句输出语句不受循环的控制了.前面定义了line=null,所以下面的输出语句当然都是null
{
System.out.println(line); //输出line
}
myBuf.myClose(); //关闭FileRead
}
|