Question: Consider the following program segment: Class A { A(String x) { System.out.print(x); } A(int p) { this(Hi there ); System.out.println(p is + p); }

Consider the following program segment:

Class A { A(String x) { System.out.print(x); } A(int p) { this("Hi there "); System.out.println("p is " + p); } }

class B extends A { B(int p, int q) { super(p); System.out.println("and q is " + q); } }

What output is generated from the above code when the following two lines are executed? A a = new A(10); B b = new B(100, 200);

1. Hi there p is 10 Hi there p is 100 and q is 200

2. Hi there p is 100 Hi there p is 10 and q is 200

3. Hi there p is 100 and q is 200 Hi there p is 10

4. Hi there p is 100 Hi there p is 10 and q is 100

Select one.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!