Assume that the current directory is "D:\workspace\ch14-test".
Choose the correct option based on this code segment:
Path testFilePath = Paths.get(".\\Main"); System.out.println("file name:" + testFilePath.getFileName()); System.out.println("absolute path:" + testFilePath.toAbsolutePath()); System.out.println("Normalized path:" + testFilePath.normalize());
a) file name:Main// w w w . java 2 s .c o m absolute path:D:\workspace\ch14-test\.\Main Normalized path:Main b) file name:Main absolute path:D:\workspace\ch14-test\Main Normalized path:Main c) file name:Main absolute path:D:\workspace\ch14-test\.\Main Normalized path:D:\workspace\ch14-test\.\Main d) file name:Main absolute path:D:\workspace\ch14-test\.\Main Normalized path:D:\workspace\ch14-test\Main
a)
the absolute path adds the path from the root directory; however, it does not normalize the path.
hence, " .\" will be retained in the resultant path.
the normalize()
method normalizes the path but does not make it absolute.