title: NIO.2 : understanding the relativize() method
body: <p>I'm struggling to understand the <code>java.nio.file.Path.relativize()</code> method. I am also aware that a similar <a href="https://stackoverflow.com/questions/37747896/understanding-java-nio-file-path-relativizepath-other">question</a> has been asked, but the answer didn't help me to understand the concept.</p>
  
  <p>Considering the following code snippet:</p>
  
  <pre><code>Path path = Paths.get("/Users/somename/documents/Test/cat.html");
  Path path2 = Paths.get("/documents/Test/cat.html");
  System.out.println((path.relativize(path2))); //output: ../../../../../documents/Test/cat.html
  </code></pre>
  
  <p>Can someone explain to me, using a step-by-step approach, how the <code>relativize()</code> method works in this example? Why do I need to go up 5 directories? </p>