I started coding again & going through mock exams and coding examples for all the questions that I get wrong. Then I came to the rules roundup question #36 "When you override a method, the overriding method in the subclass must not declare ANY new exceptions not declared in the overriden method?" (t/f).
So I read up a little bit and was going to code a subclass method overriding a base class method that declares a checked exception. Three variations of this would be: Subclass declares the same exception that the base class does, Sub declares no exceptions, and Sub declares a new checked exception. At first I was going to just override one of Java's core methods that throw a checked exception but since I got stuck so bad, I decided to first make my own exception class (Problem), then make a method that throws it (static void method(int, int) in class Roundup), and now that I've made it this far, I'll override static void method(int, int) from a subclass of Roundup to apply the three variations listed above.
So, the code is pretty trivial, its only purpose is so I can understand the principles to the questions that I get wrong. Just focusing on the Exception code and not the semantics of the other stuff, does it seem like it is set up how it should be?? I've always put off learning about exceptions, so I don't really know, but it felt kind've redundant while I was coding the exception stuff. (I guess I can remove the extends keyword from the class Roundup declaration.)
Thanks Marilyn