Menu
Question Index
...

What will be the output of the following program?

public class Company {
    public static void main(String[] args) {
        new Hardware("-Cerone-");
    }
}
class Software {
    Software() {
        this("-Software-", "-Pvt-Ltd-");
    }
    Software(String s, String t) {
        this(s);
    }
    Software(String s) {
        System.out.print(s);
    }
}
class Hardware extends Software {
    Hardware(String s) {
        System.out.print(s);
    }
    Hardware(String s, String t) {
        this(t + s + "-Company-");
    }
    Hardware() {
        super("-MeritCampus-");
    };
}


-Cerone--Software--Pvt-Ltd--Company--MeritCampus-
-Cerone--Software--Pvt-Ltd-
-Cerone--Pvt-Ltd--Software-
-Software--Pvt-Ltd--Cerone-
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Super Keyword In Java To Call Super Class Constructor

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App