Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Analyze the following code: public class Test { public static void main ( String [ ] args ) { new B ( ) ; }

Analyze the following code:
public class Test {
public static void main(String[] args){
new B();
}
}
class A {
int i=7;
public
System.out.println("i from A is "+ i);
}
public void setI(int i){
this. i=2**i;
}
}
class B extends
public
setI(20);
// System.out.println("i from B is "+ i);
}
@Override
public void setI(int i){
this. i=3**i;
}
}
a. The constructor of class A is not called.
b. The constructor of class A is called and it displays "i from A is 7".
c. The constructor of class A is called and it displavs "i from A is 40".
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions