What is the output of the following code snippet?
Assume the two directories referenced both exist and are symbolic links to the same location within the file system.
if(Files.isSameFile("/p1/p2", "/p3/p4")) System.out.println("Same!"); else System.out.println("Different!");
C.
The code does not compile because Files.isSameFile()
requires Path instances, not String values.
Option C is the correct answer.
If Path values had been used, then the code would compile and print Same!, and Option A would be the correct answer since the isSameFile()
method does follow symbolic links.