Generating a random number between specified range

To generate random numbers java users Random class and to generate integer random number nextInt(maxNo) of Random number is used the parameter maxNo specifies that this method generate a integer number between 0 and maxNo.

It will generate random number between 0 and 100, where 0 and 100 are included

Displaying directory contents

For listing a directory content in java we use File class and use isDirectory() method to check whether it is directory or not.
if directory then we use listFiles().

Displaying file properties

Checking whether a file or directory

Checking whether the File object exists if exists then check whether it is file of directory to check file existance exists() method of File class is used if it returns true means file or directory exists, at this point we are not confirm existing File object is file or directory.
To check file object isDirectory() method is used this method returns true if file object is directory otherwise it return false.
isFile() method is used to check whether the file object is file or not if it is a file then it returns true else false.