Menu
Question Index
...

What will be the output of the following program?

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


142
143
12345
Compilation Error or Runtime Error

Doubts

Problems

Topic: Creating Interface In Java With Example Program

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App