java怎么判斷某路徑下的某個文件是否存在?
public class DirectoryList { public static void main(String[] args){ String fileName="lady gaga、lady gaga - telephone ft. beyonce.mp3";//要判斷的文件或文件夾 try{ File path = new File("D:/KuGou"); String[] myList;//定義一個字符串數(shù)組 if(fileName == null && fileName.length() == 0)//不含自變量則顯示所有文件 myList = path.list(); else myList = path.list(new DirectoryFilter(fileName)); for(int i = 0; i