📄 e015. getting an absolute filename path from a relative filename path.txt
字号:
File file = new File("filename.txt");
file = file.getAbsoluteFile(); // c:\temp\filename.txt
file = new File("dir"+File.separatorChar+"filename.txt");
file = file.getAbsoluteFile(); // c:\temp\dir\filename.txt
file = new File(".."+File.separatorChar+"filename.txt");
file = file.getAbsoluteFile(); // c:\temp\..\filename.txt
// Note that filename.txt does not need to exist
Related Examples
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -