File file = new File(".\\test.txt"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); System.out.println(file.getCanonicalPath());
输出
.\test.txt E:\workspace\Test\.\test.txt E:\workspace\Test\test.txt
File file = new File(".\\test.txt"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); System.out.println(file.getCanonicalPath());
输出
.\test.txt E:\workspace\Test\.\test.txt E:\workspace\Test\test.txt