I'm not sure what is your exact question. As you said derived class may or may not throw. Therefore because of the *may throw*, main should declare or catch the exception. If you are asking why an...
Type: Posts; User: andreas90
I'm not sure what is your exact question. As you said derived class may or may not throw. Therefore because of the *may throw*, main should declare or catch the exception. If you are asking why an...
As the error message says java.lang.Exception, must be caught or declared to be thrown.
You should either declare it by adding a throws clause in your main like you do in your disp() method or catch...
Hello Arati2512!
I tried your code and it runs without any error. Are you sure this is the code that is causing the error?