Answer:
/root/sandbox/TestData1.txt
/root/sandbox/TestData2.txt
/root/sandbox/TestData3.txt and /root/sandbox/test/TestData3.txt
Grading
Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.
Once you are happy with your results, click the Submit button to record your score.
MY CODE:
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
public class CompareFolders
{
public static void main(String[] args)
{
String path1 = "/root/sandbox/TestData1.txt";
String path2 = "/root/sandbox/TestData2.txt";
String path3 = "/root/sandbox/TestData3.txt";
System.out.println("Path1 :" +path1);
System.out.println("Path3 :" +path3);
compare(path1,path3);
System.out.println("Path2 :" +path2);
System.out.println("Path3 :" +path3);
compare(path2,path3);
}
private static void compare(String path_x, String path_y) {
if (path_x.startsWith(path_y)) {
System.out.println("All files are in the same folder");
}
else {
System.out.println("Files are not in the same folder");