Menu
Topics Index
...
`

Classes1757


If you need explanation Read this topic

If you need Answer Take test on this topic

Classes1757
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-");
    };
}

A. -Cerone--Software--Pvt-Ltd--Company--MeritCampus-
B. -Cerone--Software--Pvt-Ltd-
C. -Cerone--Pvt-Ltd--Software-
D. -Software--Pvt-Ltd--Cerone-
E. Some other output
F. Compilation Error or Runtime Error
Topic: Super Keyword In Java To Call Super Class Constructor

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

E.Some other Output
O/P:-Software--Cerone-

Posted by Surendranath Reddy Sriyapu Reddy    2013-09-12 09:39:10


e is ans here in the main method we send the cerone string to hardware cons its parent class cons is executed there in that software defalut cons is called there the SOP stament is called which prints software then the ceroone is printed in the SOP of hardware constructor

Posted by Karteek Paruchuri    2013-09-12 09:46:55


Congratulations Nishan K Sharma. You are this dose winner. We will send the link using which you can claim your recharge.

Posted by Merit Campus    2013-09-13 09:26:54


© meritcampus 2019

All Rights Reserved.

Open In App