About Question enthuware.ocpjp.v8.2.1822 :
Posted: Thu Aug 09, 2018 8:19 am
				
				I have these questions..
1) Does getNameCount() starts counting from 0 or 1 ?
2) Does it include root when counting ( \ or C:) ?
3)When I run this code in eclipse:
It ouputs:
photos\..\beaches\.\calangute\a.txt
beaches\calangute\a.txt
6 3 1 1
			1) Does getNameCount() starts counting from 0 or 1 ?
2) Does it include root when counting ( \ or C:) ?
3)When I run this code in eclipse:
Code: Select all
public class test11
{
  public static void main(String args[])
  {
      Path p1 = Paths.get("photos\\..\\beaches\\.\\calangute\\a.txt");   
      
      Path p2 = p1.normalize(); 
      Path p3 = p1.relativize(p2);
      Path p4 = p2.relativize(p1);
      
      System.out.println(p1);
      System.out.println(p2);
      System.out.println(p3);
      System.out.println(p4);
      System.out.println(     p1.getNameCount()+" "+p2.getNameCount()+" "+     p3.getNameCount()+" "+p4.getNameCount());
  }
}
photos\..\beaches\.\calangute\a.txt
beaches\calangute\a.txt
6 3 1 1