Question: Create a user-defined exception class named MyException which extends Exception . Now in your main class which contains the main method, create another static method
Create a user-defined exception class named MyException which extends Exception. Now in your main class which contains the main method, create another static method named getSquareRoot() to compute the square root of any given number. From the main method, call the getSquareRoot() method and it throws exception of MyException class. The exception is thrown when we pass a negative number as parameter for computing square root. The method from which getSquareRoot() is called, will handle the exception.
language : java.
please solve asap.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
