Write a class that throws an extraneousstringexception when


Question :

Write a class that throws an ExtraneousStringException when a string has more than 30 characters in it (see ExtraneousStringException.java.This java file does not need to be modified).

Copy paste the contents of ExtraneousStringException.java into a new .java file, uncomment the commented out code, and write your code inside the main method.

In the driver class, keep reading strings from the user until the user enters "DONE."

You may read your input from a file, or use the console. public class LastName_HW01Q1 { public static void main(String[] args) throws ExtraneousStringException { // Write your code here. } */ static class ExtraneousStringException extends Exception { public ExtraneousStringException() { super("String too long"); } } }

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Write a class that throws an extraneousstringexception when
Reference No:- TGS02909440

Now Priced at $15 (50% Discount)

Recommended (98%)

Rated (4.3/5)