How can one stop the IOException question being raised on something as such:
public class ExampleClass {
String path = "path to directory";
Path filePath = Paths.get(path);
BasicFileAttributes Attr = Files.readAttributes(filePath, BasicFileAttributes.class);
...
}
I receive a warning from IntelliJ stating Unhandled exception: java.io.IOException
on the last line BasicFileAttributes inAttr = Files.readAttributes(filePathIn, BasicFileAttributes.class);
If I put these declarations within a method that throws an IOException, the warning does go away... But I am wanting this declared as a global variable... Am I missing something?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…