importjava.io.File;publicclassPathDemo{publicstaticvoidmain(Stringargs[]){System.out.println("Path of the given file :");Filechild=newFile(".././Java.txt");displayPath(child);Fileparent=child.getParentFile();System.out.println("Path of the parent folder :");displayPath(parent);FileanotherFile=newFile("a.txt");System.out.println("Path of another file(a.txt)");displayPath(anotherFile);FileanotherAbsFile=newFile("/tmp/a.txt");System.out.println("Path of another file(/tmp/a.txt)");displayPath(anotherAbsFile);}publicstaticvoiddisplayPath(FiletestFile){System.out.println("path : "+testFile.getPath());System.out.println("absolute path : "+testFile.getAbsolutePath());try{System.out.println("canonical path : "+testFile.getCanonicalPath());}catch(Exceptione){e.printStackTrace();}}}