我不能调用这个函数,虽然它确实抛出了 amnd 句柄 IOException
public static String[] readtxt(String f) throws IOException{
try{
FileReader fileReader=new FileReader(f);
BufferedReader bufferedReader=new BufferedReader(fileReader);
List<String> lines=new ArrayList<String>();
String line=null;
while((line=bufferedReader.readLine())!=null)lines.add(line);
bufferedReader.close();
return lines.toArray(new String[lines.size()]);
}catch(IOException e){return null;}
}
...
private String[] truth=MainActivity.readtxt(file);
// ^ wont compile: Unhandled exception type IOException