Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*public*/ class Parent {
- public void display(Object s) {
- System.out.println("In Parent with " + s);
- }
- }
- /*public*/ class Child extends Parent {
- // @Override
- public void display(String s) {
- System.out.println("In Child with " + s);
- super.display(s);
- ((Parent) this).display(s);
- }
- }
- public class OOPSMain {
- public static void main(String[] args) {
- Child p = new Child();
- p.display("Java is little complex");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement