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 45 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
Great answer, keep it coming :)


AISCAMPING

  • Member
  • Posts: 347
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Pink eye is a term that refers to conjunctivitis, which is inflammation of the thin, clear membrane (conjunctiva) over the white part of the eye (sclera). It may be triggered by a virus, bacteria, or foreign body in the eye. Antibiotic eye drops alleviate bacterial conjunctivitis, and antihistamine allergy pills or eye drops help control allergic conjunctivitis symptoms.

Did you know?

Though Candida and Aspergillus species are the most common fungal pathogens causing invasive fungal disease in the immunocompromised, infections due to previously uncommon hyaline and dematiaceous filamentous fungi are occurring more often today. Rare fungal infections, once accurately diagnosed, may require surgical debridement, immunotherapy, and newer antifungals used singly or in combination with older antifungals, on a case-by-case basis.

Did you know?

Cytomegalovirus affects nearly the same amount of newborns every year as Down syndrome.

Did you know?

Amoebae are the simplest type of protozoans, and are characterized by a feeding and dividing trophozoite stage that moves by temporary extensions called pseudopodia or false feet.

Did you know?

The types of cancer that alpha interferons are used to treat include hairy cell leukemia, melanoma, follicular non-Hodgkin's lymphoma, and AIDS-related Kaposi's sarcoma.

For a complete list of videos, visit our video library