Menu
Question Index
...

What will be the output of the following program?

public class Dravid implements MyClass.MyInterface {
    public static void main(String[] args) {
        Dravid dravid = new Dravid();
        dravid.method();
        MyClass myClass = new MyClass();
        myClass.MyClass();
    }
    public void method() {
        System.out.println("Interface Method");
    }
}
class MyClass {
    interface MyInterface {
        void method();
    }
    public void MyClass() {
        System.out.println("MyClass Method");
    }
}


Interface Method
MyClass Method
Some other output
Compilation Error since nested interface not allowed
Compilation Error or Runtime Error for some other reason

Doubts

Problems

Topic: Advanced Java Programming Concepts

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App