java判断路径是文件夹还是文件
1 import java.io.File; 2 public class Flie_or_Folder { 3 4 public static void main(String s[]){ 5 String path ="/Users/XXXXX/Desktop/one"; 6 File file = new File(path); 7 if(file.isDirectory()){ 8 System.out.println("是文件夹"); 9 } 10 if(file.isFile()){ 11 System.out.println("是文件"); 12 } 13 } 14 }