Answered
Define an exception class called NegativeNumberException.The class should have a constructor with no parameters.If an exception is thrown with this zero-argument constructor,getMessage should return "Negative Number Not Allowed!" The class should also have a constructor with a single parameter of type String.If an exception is thrown with this constructor,then getMessage returns the value that was used as an argument to the constructor.
On Jun 23, 2024