PHP中文网2017-04-17 17:59:25
String dirPath = parentFile.getAbsolutePath();
The code here will never be executed, so the editor reminds you that this is dead code
ringa_lee2017-04-17 17:59:25
The File type returned by getAbsoluteFile() is not String, so it should
File f=new File("s").getParentFile().getAbsoluteFile();
ringa_lee2017-04-17 17:59:25
There is something wrong with your logic. If it is equal to null, but you want to get its absolute path, even if no error is reported, it must be NullPointException
.
阿神2017-04-17 17:59:25
Think more about it yourself when encountering this kind of problem. This is obviously a grammatical error. You can see the cause of the error by placing your cursor on the red wavy line.