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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started