java - 关于文件的问题
大家讲道理
大家讲道理 2017-04-17 17:57:25
0
4
356

为什么会报错,求解决

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
洪涛
String dirPath = parentFile.getAbsolutePath();

The code here will never be executed, so the editor reminds you that this is dead code

左手右手慢动作

The File type returned by getAbsoluteFile() is not String, so it should

File f=new File("s").getParentFile().getAbsoluteFile();
左手右手慢动作

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.

阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template