file input error
下面的两个功能对吗?为什么老是进入catch ()里?? (源代码太长)
try{
//计算行数
File fis = new File ("C:\\myfile.txt");
BufferedReader dis = new BufferedReader(fis);
while(dis.readLine()!=null){
enter_count++;
}
//将每一行符值给一个字符串
fis = new FileInputStream("C:\\myfile.txt");//由于上面的dis.readLine()将文件读完了,所以要从新初始化一遍
dis = new DataInputStream(fis);
String s[] = new String[enter_count];
i = 0;
while(dis.available()!=0){
s[i] = dis.readLine();
s1[i]=s[i];
i++;
}
dis.close();
}catch(Exception e){
System.err.println("File input error");
}
}
}