Menu
Question Index
...

What is the output of the program?

public abstract class DemoOnAbstractClasses {
    public int getValue() {
        return 28;
    }
    public abstract class DemoClass {

        public int getValue() {
            return 33;
        }
    }
    public static void main(String args[]) {
        DemoOnAbstractClasses objectOfAbstractClasses = new DemoOnAbstractClasses() {
            public int getValue() {
                return 45;
            }
        };
        DemoOnAbstractClasses.DemoClass demoClass = objectOfAbstractClasses.new DemoClass() {
            public int getValue() {
                return 66;
            }
        };
    System.out.println(demoClass.getValue() + "," + objectOfAbstractClasses.getValue());
    }
}


66, 45
Compilation Error due to  class created in another class
45, 33
Runtime error
Compilation Error due to other reasons

Doubts

Problems

Topic: Nested And Inner Classes

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App