Consider the following program:
import java.nio.file.*; import java.io.IOException; public class Main { public static void main(String []args) throws IOException { Path aFilePath = Paths.get("D:\\directory\\file.txt"); System.out.println(aFilePath.isAbsolute()); } }
Assuming that the file D:\\directory\\file.txt does not exist, what will be the behavior of this program?.
B.
to use methods such as isAbsolute()
, the actual file need not exist.
Because the path represents an absolute path (and not a relative path), this program prints true.