Java program to distinguish between a file and a directory

Today, we are going to have an example that will help us to understand how we can distinguish folders or directories and files through Java Program. Java program to distinguish between a file and a directory: import java.io.File; class Directory{ public static void main(String[] args){ String directory=”/exampledirectroy”;//example directory name File file1=new File(directory);//instantiating file class with […]