subject

Public class Membership {
private String id;
public Membership(String input)
{ id = input; }
// Rest of definition not shown
}
public class FamilyMembership extends Membership
{
private int numberInFamily = 2;
public FamilyMembership(String input)
{ super(input); }
public FamilyMembership(String input, int n)
{
super(input);
numberInFamily = n;
}
// Rest of definition not shown
}
public class IndividualMembership extends Membership
{
public IndividualMembership(String input)
{ super(input); }
// Rest of definition not shown
}
The following code segment occurs in a class other than Membership, FamilyMembership, or IndividualMembership.
FamilyMembership m1 = new Membership("123"); // Line 1
Membership m2 = new IndividualMembership("456"); // Line 2
Membership m3 = new FamilyMembership("789"); // Line 3
FamilyMembership m4 = new FamilyMembership("987", 3); // Line 4
Membership m5 = new Membership("374"); // Line 5
Which of the following best explains why the code segment does not compile?
A) In line 1, m1 cannot be declared as type FamilyMembership and instantiated as a Membership object.
B) In line 2, m2 cannot be declared as type Membership and instantiated as an IndividualMembership object.
C) In line 3, m3 cannot be declared as type Membership and instantiated as a FamilyMembership object.
D) In line 4, m4 cannot be declared as type FamilyMembership and instantiated as a FamilyMembership object.
E) In line 5, m5 cannot be declared as type Membership and instantiated as a Membership object.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
How can a user delete a drawing object
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
You know the right answer?
Public class Membership {
private String id;
public Membership(String input)
{ id...
Questions
question
Mathematics, 05.12.2021 01:30
question
Mathematics, 05.12.2021 01:30
question
Mathematics, 05.12.2021 01:30
Questions on the website: 13722360