Hi all,
I saw this
test in Sierra/Bates study guide:
Having a directory x under c: drive what is the result of System.out.println(Paths.get("c:/x/z/..").toRealPath()); ?
I answered c:\x but according to the solution this is wrong. Correct solution should be: throws NoSuchFileException. The toRealPath() function actually looks at the filesystem. Since there is no directory named z an exception is thrown.
I thought that path was normalized removing directory z, but according the solution this should not be done.
However If i try
System.out.println(Paths.get("c:/users/BONPAS00/Documents/XXXXX/..").toRealPath());
the output is C:\Users\BONPAS00\Documents.
So I don't underdsand the exact behavior.
Thanks