/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
abstract class ParentClass {
public abstract void methodA();
}
class ChildClass1 extends ParentClass {
public void methodA() {
System.
out.
println("Implementation from ChildClass1"); }
}
class ChildClass2 extends ChildClass1 {
public void methodA() {
System.
out.
println("Implementation from ChildClass2"); }
}
class ChildClass3 extends ChildClass2 {
// ChildClass3 inherits the implementation of methodA from ChildClass2
// It does not need to provide its own implementation
}
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
// your code goes here
ChildClass3 object = new ChildClass3();
object.methodA(); // Output: "Implementation from ChildClass2"
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgoKYWJzdHJhY3QgY2xhc3MgUGFyZW50Q2xhc3MgewogICAgcHVibGljIGFic3RyYWN0IHZvaWQgbWV0aG9kQSgpOwp9CgpjbGFzcyBDaGlsZENsYXNzMSBleHRlbmRzIFBhcmVudENsYXNzIHsKICAgIHB1YmxpYyB2b2lkIG1ldGhvZEEoKSB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJJbXBsZW1lbnRhdGlvbiBmcm9tIENoaWxkQ2xhc3MxIik7CiAgICB9Cn0KCmNsYXNzIENoaWxkQ2xhc3MyIGV4dGVuZHMgQ2hpbGRDbGFzczEgewogICAgcHVibGljIHZvaWQgbWV0aG9kQSgpIHsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkltcGxlbWVudGF0aW9uIGZyb20gQ2hpbGRDbGFzczIiKTsKICAgIH0KfQoKY2xhc3MgQ2hpbGRDbGFzczMgZXh0ZW5kcyBDaGlsZENsYXNzMiB7CiAgICAvLyBDaGlsZENsYXNzMyBpbmhlcml0cyB0aGUgaW1wbGVtZW50YXRpb24gb2YgbWV0aG9kQSBmcm9tI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