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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started