Menu
Question Index
...

What will be the output of the following program? Assume that all the classes belong to the same package.

class CURD {

    public static void main(String[] args) {
        new C().create();
        new D().update();
        new R().read();
        new D().delete();
    }
}

class C {
    public void create() { System.out.print("c"); }
}

class U {
    private void update() { System.out.print("u"); }
}

class R extends C {
    public void create() { System.out.print("C"); }
    protected void read() { System.out.print("R"); }
}

class D extends U {
    void update() { System.out.print("U"); }
    void delete() { System.out.print("D"); }
}


cURD
cuRD
CURD
Compilation Error

Doubts

Problems

Topic: Method Overriding In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App