-5

http://www.raykor.com/prob2solve.aspx here is the link to the question.i have created directories and files that are required. I may have not understood the question properly but so far i have tried my best. Could try to read and understand the question and give a hint to solve the same.

1 Answers1

5

It isn't very clear what your quesiton is, but based on the title, the best way to determine the relative path of a file in Java is to use the Path relativize(Path other) method described here.

As an example, here's how it could be used to solve the first problem on that site:

import java.io.IOException;
import java.nio.file.*;

public void printFilesInPath(Path start) throws IOException {
    Files.walk(start)
         .filter(path -> path.toFile().isFile())
         .forEach(path -> System.out.println(start.relativize(path)));
}
Justin Kaufman
  • 251
  • 1
  • 5