my current directory is c:/myprograms when i run this code, a directory named zen is created inside the myprograms folder .
1. why not the NoSuchFileException , as there is no alto directory exist.
2. why only zen folder is created, where the alto has gone ?
3. how ".." is working here ?
Sergej Smoljanov wrote:.. mean that you up one folder up
when you use this
where you find directory you crated?
this is my own code which i was trying to understand the working of ".."
and still in confusion. I know that ".." up one folder. and in your code it will do nothing as there is no upper folder present (correct if i am wrong).
please answer all my 3 questions
in this case you get dir created on c:/
3. how ".." is working here ? "alto","..","zen" become zen, you go into alto than up one directory and create zen in current directory
1. why not the NoSuchFileException , as there is no alto directory exist. - because before create you up one directory upward and create directory in current directory
2. why only zen folder is created, where the alto has gone ? there is no reason alto because your path in real not need this folder.
You cant create folder "one folder up" so you can think about this like erase any folder that was mentioned before ..
Files.createDirectory(p.normalize()); - you can think this way, this way i think about this behavior.
also this will show one more behavior, i think that it is exception from rule that i mentioned:
you get root and there is no directory up root, so you create dir in root (c:/)