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

Author Question: Show the output of running the class Test in the following code lines:interface A {}class C { }class ... (Read 47 times)

arivle123

  • Hero Member
  • *****
  • Posts: 569

Question 1

Which of the following is incorrect?
◦ The constructors in an abstract class should be protected.
◦ You may declare a final abstract class.
◦ An abstract class contains constructors.
◦ The constructors in an abstract class are private.
◦ An interface may contain constructors.

Question 2

Show the output of running the class Test in the following code lines:

interface A {
}

class C {
}

class B extends D implements A {
}

public class Test {
public static void main(String[] args) {
B b = new B();
if (b instanceof A)
System.out.println("b is an instance of A");
if (b instanceof C)
System.out.println("b is an instance of C");
}
}

class D extends C {
}

◦ b is an instance of C.
◦ b is an instance of A followed by b is an instance of C.
◦ Nothing.
◦ b is an instance of A.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

mistyjohnson

  • Sr. Member
  • ****
  • Posts: 331
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 50% of students answer this correctly




arivle123

  • Member
  • Posts: 569
Reply 2 on: May 6, 2020
Gracias!


Joy Chen

  • Member
  • Posts: 354
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

The longest a person has survived after a heart transplant is 24 years.

Did you know?

The first war in which wide-scale use of anesthetics occurred was the Civil War, and 80% of all wounds were in the extremities.

Did you know?

Cutaneous mucormycosis is a rare fungal infection that has been fatal in at least 29% of cases, and in as many as 83% of cases, depending on the patient's health prior to infection. It has occurred often after natural disasters such as tornados, and early treatment is essential.

Did you know?

Hypertension is a silent killer because it is deadly and has no significant early symptoms. The danger from hypertension is the extra load on the heart, which can lead to hypertensive heart disease and kidney damage. This occurs without any major symptoms until the high blood pressure becomes extreme. Regular blood pressure checks are an important method of catching hypertension before it can kill you.

Did you know?

Patients who have undergone chemotherapy for the treatment of cancer often complain of a lack of mental focus; memory loss; and a general diminution in abilities such as multitasking, attention span, and general mental agility.

For a complete list of videos, visit our video library