Hi Guys,
I created this class StringTooLongException, which extends the exception class, then I created another class which basically takes in user input, and if
string is too long (more than 20 characters), StringTooLongException is thrown.
here is the idea
so if exception is thrown program terminates.
Now, in another project, I am supposed to catch the exception and print the message.
so when I put the if-else statement under try block, and then there is a corresponding catch block..........it doesn't work......I only know how to catch exceptions that are
built into
Java like Arithmetic exception.......
Anyways, compiler says "StringTooLongException" is already defined in main......what am I doing wrong??? How do I catch the exception???
Thanks