Menu
Question Index
...

What will be the output of the following program?

interface SixesMachine {
    void hitSixes();
}
abstract class DhoniInTheMaking implements SixesMachine {
    public String numberOfSixes() {
        return "6 0 6 3 6 6 6 6";
    }
    public void printRunsTrail(String runsAndRuns) {
        System.out.println(runsAndRuns);
    }
}
public class Dhoni extends DhoniInTheMaking {
    public static void main(String args[]) {
        DhoniInTheMaking outputClass = new Dhoni();
        outputClass.hitSixes();
    }
    public void hitSixes() {
        numberOfSixes();
        printRunsTrail(numberOfSixes());
    }
}


6 0 6 3 6 6 6 6
6 0 6 3 6 6 6 6
6 0 6 3 6 6 6 6
Compilation Error
Runtime Error

Doubts

Problems

Topic: Difference Between Interfaces And Abstract Classes

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App