Menu
Question Index
...

What will be the output of following program?

interface two {

    int a = 10;

    void root();
}

interface three extends two {

    int b = 30;

    void multiplication();
}

class Multiplication implements three {

    public void root() {
        System.out.println(Math.rint(Math.sqrt(a)));
    }

    public void multiplication() {
        System.out.println(a * b);
    }
}

public class Calculation {

    public static void main(String args[]) {
        Multiplication m = new Multiplication();
        m.root();
        m.multiplication();
    }
}


3
300
3.0
300
3.162
300
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