Are siblings?

Report a typo

Implement the method areSibling that checks if the files have the same parent.

It should take two files and return true if the files have the same parent and false otherwise.

Sample Input 1:

dir/file1.txt
dir/file2.txt

Sample Output 1:

true
Write a program in Java 17
import java.io.File;

class Siblings {

public static boolean areSiblings(File f1, File f2) {
// implement me
}
}
___

Create a free account to access the full topic