比较两个文件路径
import java.io.*;/** N o w J a v a . c o m - 时 代 Java 提供 **/ public class Main { public static void main(String[] args) { //create first file object File file1 = new File("C://Folder//demo1.txt"); //create second file object File file2 = new File("C://Folder//demo1.txt"); if(file1.compareTo(file2) == 0) { System.out.println("Both paths are same!"); }