class Ideone {
public static void main
(String[] args
) { FooExtends1 foo1 = new FooExtends1();
changeName(foo1);
System.
out.
println(foo1.
getName());
FooExtends2 foo2 = new FooExtends2();
changeName(foo2);
System.
out.
println(foo2.
getName());
FooExtends3 foo3 = new FooExtends3();
changeName(foo3);
System.
out.
println(foo3.
getName()); }
public static void changeName(Foo param1) {
param1.setName("foo");
}
}
class Foo {
public void setName
(String name
) { this.name = name;
}
return name;
}
}
class FooExtends1 extends Foo {}
class FooExtends2 extends Foo {}
class FooExtends3 extends Foo {}
Y2xhc3MgSWRlb25lIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBGb29FeHRlbmRzMSBmb28xID0gbmV3IEZvb0V4dGVuZHMxKCk7CiAgICAgICAgY2hhbmdlTmFtZShmb28xKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oZm9vMS5nZXROYW1lKCkpOwoKICAgICAgICBGb29FeHRlbmRzMiBmb28yID0gbmV3IEZvb0V4dGVuZHMyKCk7CiAgICAgICAgY2hhbmdlTmFtZShmb28yKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oZm9vMi5nZXROYW1lKCkpOwoKICAgICAgICBGb29FeHRlbmRzMyBmb28zID0gbmV3IEZvb0V4dGVuZHMzKCk7CiAgICAgICAgY2hhbmdlTmFtZShmb28zKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oZm9vMy5nZXROYW1lKCkpOwogICAgfQoKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBjaGFuZ2VOYW1lKEZvbyBwYXJhbTEpIHsKICAgICAgICBwYXJhbTEuc2V0TmFtZSgiZm9vIik7CiAgICB9Cn0KCmNsYXNzIEZvbyB7CiAgICBwcml2YXRlIFN0cmluZyBuYW1lOwoKICAgIHB1YmxpYyB2b2lkIHNldE5hbWUoU3RyaW5nIG5hbWUpIHsKICAgICAgICB0aGlzLm5hbWUgPSBuYW1lOwogICAgfQoKICAgIHB1YmxpYyBTdHJpbmcgZ2V0TmFtZSgpIHsKICAgICAgICByZXR1cm4gbmFtZTsKICAgIH0KfQoKY2xhc3MgRm9vRXh0ZW5kczEgZXh0ZW5kcyBGb28ge30KY2xhc3MgRm9vRXh0ZW5kczIgZXh0ZW5kcyBGb28ge30KY2xhc3MgRm9vRXh0ZW5kczMgZXh0ZW5kcyBGb28ge30=