Java examples for File Path IO:Directory
Determine File or Directory
import java.io.File; public class Main { public static void main(String[] args) { File file = new File("C://FileIO"); boolean isFile = file.isFile(); if (isFile)/* w ww .j a va 2 s . co m*/ System.out.println(file.getPath() + " is a file."); else System.out.println(file.getPath() + " is not a file."); boolean isDirectory = file.isDirectory(); if (isDirectory) System.out.println(file.getPath() + " is a directory."); else System.out.println(file.getPath() + " is not a directory."); } }