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
Get step-by-step solutions from verified subject matter experts
