This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code:public class Test { public static void main(String[] args) {new B(); ... (Read 36 times)

cartlidgeashley

  • Hero Member
  • *****
  • Posts: 572
Analyze the following code:

public class Test {
public static void main(String[] args) {
new B();
}
}

class A {
int i = 7;
 
public A() {
setI(20);
System.out.println("i from A is " + i);
}
 
public void setI(int i) {
this.i = 2 * i;
}
}

class B extends A {
public B() {
// System.out.println("i from B is " + i);
}
 
public void setI(int i) {
this.i = 3 * i;
}
}

◦ The constructor of class A is called and it displays "i from A is 40".
◦ The constructor of class A is called and it displays "i from A is 7".
◦ The constructor of class A is called and it displays "i from A is 60".
◦ The constructor of class A is not called.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by cartlidgeashley on May 6, 2020

lcapri7

  • Sr. Member
  • ****
  • Posts: 350
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




cartlidgeashley

  • Member
  • Posts: 572
Reply 2 on: May 6, 2020
Wow, this really help


gcook

  • Member
  • Posts: 343
Reply 3 on: Yesterday
Excellent

 

Did you know?

Your skin wrinkles if you stay in the bathtub a long time because the outermost layer of skin (which consists of dead keratin) swells when it absorbs water. It is tightly attached to the skin below it, so it compensates for the increased area by wrinkling. This happens to the hands and feet because they have the thickest layer of dead keratin cells.

Did you know?

According to the American College of Allergy, Asthma & Immunology, more than 50 million Americans have some kind of food allergy. Food allergies affect between 4 and 6% of children, and 4% of adults, according to the CDC. The most common food allergies include shellfish, peanuts, walnuts, fish, eggs, milk, and soy.

Did you know?

Since 1988, the CDC has reported a 99% reduction in bacterial meningitis caused by Haemophilus influenzae, due to the introduction of the vaccine against it.

Did you know?

Most strokes are caused when blood clots move to a blood vessel in the brain and block blood flow to that area. Thrombolytic therapy can be used to dissolve the clot quickly. If given within 3 hours of the first stroke symptoms, this therapy can help limit stroke damage and disability.

Did you know?

You should not take more than 1,000 mg of vitamin E per day. Doses above this amount increase the risk of bleeding problems that can lead to a stroke.

For a complete list of videos, visit our video library