Westonci.ca is the premier destination for reliable answers to your questions, provided by a community of experts. Discover solutions to your questions from experienced professionals across multiple fields on our comprehensive Q&A platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
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");
Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.