Menu
Question Index
...

What will be the output of the following program?

class I1 {
    public static void main(String[] args) {
        A a = new A();
        a.m1();
        a.m4();
        B.class.m2();
    }
}
interface I {
    void m1();
    void m4();
}
interface I2 {
    void m2();
}
class A implements I {
    public void m1() {    System.out.print("1");    }
    public void m4() {    System.out.print("2");    }
}
abstract class B implements I2 {
    public void m1() {    }
    public void m2() {    System.out.print("3");    }
    void m3() {    }
}


12
123
12123
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Future Task Java Program Using Interfaces

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App