Question: CODE IN JAVA Write a static method static boolean isDirectory(String filePath), that takes as an argument the path of a the file and returns a

CODE IN JAVA

Write a static method static boolean isDirectory(String filePath), that takes as an argument the path of a the file and returns a boolean value whether the given path represents a directory. If the file with the given path doesnt exist, throw a custom exception (checked) called PathNotFoundException with a meaningful message. Create the class for the custom exception. In the main method, call isDirectory method, handle the possible exception. If the exception occurs, catch it and print out the message. The execution of the main method should not be halted by the possible exceptions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!