Page 1 of 1

About Question enthuware.ocpjp.v7.2.1602 :

Posted: Sun Feb 28, 2016 5:20 am
by Chen@ukr.net
an empty path is returned if this path does have a root component and all name elements are redundant
but i try:

Code: Select all

Path p = Paths.get("C:\\\\..");
        System.out.println(p.normalize());
        //C:\
i can`t repeat condition:
an empty path is returned if this path does have a root component and all name elements are redundant
my assumption that must be
an empty path is returned if this path does not have a root component and all name elements are redundant

Re: About Question enthuware.ocpjp.v7.2.1602 :

Posted: Sat Aug 12, 2017 1:46 pm
by kakawi
By the way, I tried this code on Linux (Ubuntu) and found that

Code: Select all

normalize()

doesn't work for Windows path
On my machine it work only for paths like /home/foo/bar/../..

Re: About Question enthuware.ocpjp.v7.2.1602 :

Posted: Sun Aug 13, 2017 2:15 am
by admin
The statement in the explanation is correct as per Javadoc https://docs.oracle.com/javase/8/docs/a ... ormalize--