Menu
Question Index
...

What will be the output of the following program?

interface SixesMachine {
    void hitSixes();
}

public abstract class DhoniInTheMaking implements SixesMachine {
    public String numberOfSixes() {
        return "6 0 6 3 6 6 6 6";
    }
    private void printRunsTrail(String runsAndRuns) {
        System.out.println(runsAndRuns);
    }
}

class Dhoni extends DhoniInTheMaking {
    public static void main(String args[]) {
        DhoniInTheMaking outputClass = new Dhoni();
        outputClass.hitSixes();
    }
    public void hitSixes() {
        numberOfSixes().substring(5, 12);
        printRunsTrail(numberOfSixes().substring(3, 7));
    }
}


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

Doubts

Problems

Topic: Access Modifiers 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