Java tutorial
import java.io.File; public class Main { public static void main(String[] args) { File f = new File("test.txt"); File f1 = new File("File/test1.txt"); // returns integer value int value = f.compareTo(f1); if (value == 0) { System.out.print(" = "); } else if (value > 0) { System.out.print(" > "); } else { System.out.print(" < "); } System.out.print("Value returned: " + value); } }