Menu
Question Index
...

What will be the output of the following program?

public class Example {

    public static void main(String args[]) {
        Area a = new Area();
        a.area1();
        a.area2();
    }
}

interface C {

    int side = 4;

    void area1();
}

interface D extends C {

    double length = 3.5;
    double breadth = 4.5;

    void area2();
}

class Area implements D {

    public void area1() {
        System.out.println(side * side);
    }

    public void area2() {
        System.out.println(length * breadth);
    }
}


16
15.0
16
15.75
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Extending Interface In Java (extends)

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App