Question: code in java a. Write a program that creates an exception class called InvalidStringException which can handle two types of errors: A String that is
code in java
a. Write a program that creates an exception class called InvalidStringException which can handle two types of errors:
A String that is too long. The program detecting the exception should pass the length of the String and the maximum allowed length
A String that contains invalid characters. The program detecting the exception should pass the String and the invalid characters.
b. Write a main method that opens an input file for reading. It will read one line at a time. If any character in the String are digits, it will report an exception on that line. If any line is longer than 20 characters long, it will report an exception on that line.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
