Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions