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.
Asked
Active
Viewed 1,387 times
-5
-
5Please describe the relevant parts of the "question" here. Also show what you have done and where exactly you fail. – Seelenvirtuose Apr 07 '15 at 07:38
1 Answers
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
-
A badly worded question, but you made a good effort of answering based on title. – vegemite4me May 05 '16 at 16:29