Menu
Question Index
...

What will be the output of the following program?

public class Test {
    public static void main(String[] args) {
        new Z().method1();
        new Z().method2();
    }
}
abstract class X {
    abstract void method1();
    abstract void method2();
}
abstract class Y extends X {
    void method1() {
        System.out.println("Method1 implemented here.");
    }
}
class Z extends Y {
    void method2() {
        System.out.println("Method2 implemented here.");
    }
}


Method2 implemented here.
Method1 implemented here.
Method1 implemented here.
Method2 implemented here.
Compilation Error or Runtime Error

Doubts

Problems

Topic: Rules For Abstract Methods and Abstract Classes

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App