Coming to overridding concept.....When we override any parent class method inside child class,the child class cannot restrict the access specifier of parent class inside child class.
suppose parent class method have a "public" method,when child class method overrides that method it cannot make that method as private/default/protected.
Similarly if parent class method has "protected" method,then child class cannot make its method as a private/default.
When it comes to Exception handling.... (1)the child class method can throw the same Exception or subclass of that Exception which the perent class method is throwing.....only if the parent class method is throwing "compile time/Checked Exception."
(2)The child class method can throw Exception other than what the parent class method is throwing only if the parent class method is throwing RunTimeExceptions........Read alll these point carefully.i hope everybody can understand,bye.
Another way of looking at the rules about new Exceptions or access modifiers; no method of a subclass may make any more demands on its clients than its superclass counterpart. You can't insist the client handle any more exceptions and can't insist on any more restrictive access. Otherwise you couldn't use polymorphism.
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, that will fit in a stocking