class Ideone {
public static void main
(String[] args
) { ChildClass c = new ChildClass();
c.methodB();
}
}
class ParentClass {
private void methodA() {
System.
out.
println("This is Parent A Method"); }
public void methodB() {
System.
out.
println("This is Parent B Method and I am Calling Method A"); methodA();
}
}
class ChildClass extends ParentClass {
public void methodA() {
System.
out.
println("This is Child A Method and I am Calling Parents Method A"); super.methodA();
}
@Override
public void methodB() {
System.
out.
println("This is Child B Method and I am Calling Parents Method B"); super.methodB();
}
}
Y2xhc3MgSWRlb25lIHsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB7CgkJQ2hpbGRDbGFzcyBjID0gbmV3IENoaWxkQ2xhc3MoKTsKCQljLm1ldGhvZEIoKTsKCX0KfQogCmNsYXNzIFBhcmVudENsYXNzIHsKICAgIHByaXZhdGUgdm9pZCBtZXRob2RBKCkgewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiVGhpcyBpcyBQYXJlbnQgQSBNZXRob2QiKTsKICAgIH0KIAogICAgcHVibGljIHZvaWQgbWV0aG9kQigpIHsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIlRoaXMgaXMgUGFyZW50IEIgTWV0aG9kIGFuZCBJIGFtIENhbGxpbmcgTWV0aG9kIEEiKTsKICAgICAgICBtZXRob2RBKCk7CiAgICB9Cn0KIApjbGFzcyBDaGlsZENsYXNzIGV4dGVuZHMgUGFyZW50Q2xhc3MgewogICAgcHVibGljIHZvaWQgbWV0aG9kQSgpIHsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIlRoaXMgaXMgQ2hpbGQgQSBNZXRob2QgYW5kIEkgYW0gQ2FsbGluZyBQYXJlbnRzIE1ldGhvZCBBIik7CiAgICAgICAgc3VwZXIubWV0aG9kQSgpOwogICAgfQogCiAgICBAT3ZlcnJpZGUKICAgIHB1YmxpYyB2b2lkIG1ldGhvZEIoKSB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJUaGlzIGlzIENoaWxkIEIgTWV0aG9kIGFuZCBJIGFtIENhbGxpbmcgUGFyZW50cyBNZXRob2QgQiIpOwogICAgICAgIHN1cGVyLm1ldGhvZEIoKTsKICAgIH0KfQ==