Question: Create a custom exception class ValidationException. Create a class Phone that has a constructor with two parameters name and serialNumber. Throw a ValidationException from class
Create a custom exception class ValidationException. Create a class Phone that has a constructor with two parameters name and serialNumber. Throw a ValidationException from class Phone’s constructor if an empty value is passed for either parameter or if the serial number is not exactly 16 digits. Demonstrate this exception class using a Java application.
Step by Step Solution
3.45 Rating (158 Votes )
There are 3 Steps involved in it
Sure here is one way you could create the ValidationException class and Phone class in Java along with a test class to demonstrate using these classes ... View full answer
Get step-by-step solutions from verified subject matter experts
