Hi All,
May be this could be silly question but its asked in 3-4 interviews that why following rules are there for overriding:-
Rules
1. If BaseClass having a method whose return type are any primitive-type then while overriding this method, you can't change its return-type.
2. If BaseClass having a method whose return type are any user-defined data-type then while overriding this method, you can keep same return-type or change its return-type by its derived-class.
3. If BaseClass having a method whose thorws a IOException then while overriding you can keep same exception or can change it by its derived-class.