Q1: Write a class that throws an ExtraneousStringException when a string has more than 30 characters…

Q1: 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”); } } }