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

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!