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
Get step-by-step solutions from verified subject matter experts
