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 61 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
Thanks for the timely response, appreciate it


CAPTAINAMERICA

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

 

Did you know?

Allergies play a major part in the health of children. The most prevalent childhood allergies are milk, egg, soy, wheat, peanuts, tree nuts, and seafood.

Did you know?

According to the Migraine Research Foundation, migraines are the third most prevalent illness in the world. Women are most affected (18%), followed by children of both sexes (10%), and men (6%).

Did you know?

More than 2,500 barbiturates have been synthesized. At the height of their popularity, about 50 were marketed for human use.

Did you know?

Many medications that are used to treat infertility are injected subcutaneously. This is easy to do using the anterior abdomen as the site of injection but avoiding the area directly around the belly button.

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