有人可以尝试使用Java中的资源吗?>
try(InputStream inputStream = new FileInputStream(new File(some file))) { if(inputStream == null) //Line 3 { } } catch(IOException e) { }
我想知道,是否有必要在第3行检查null。在任何情况下,inputStream在第3行都可以为null吗?
[有人可以尝试使用Java中的资源吗try(InputStream inputStream = new FileInputStream(new File(some file))){if(inputStream == null)//第3行{}} catch(IOException ...
给出您的代码,否:
我想知道,是否有必要在第3行上检查null。