Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Java is insane.
- // If you create an instance of SubClass, and call testMethod() on it,
- // it will output "In the subclass".
- public class SuperClass
- {
- public void testMethod()
- {
- this.overriddenMethod();
- }
- public void overriddenMethod()
- {
- System.out.println("In the superclass");
- }
- }
- public class SubClass extends SuperClass
- {
- public void overriddenMethod()
- {
- System.out.println("In the subclass");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment