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 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
You know the right answer?
Public class Membership {
private String id;
public Membership(String input)
{ id...
Questions
question
Chemistry, 14.09.2021 20:10
question
Mathematics, 14.09.2021 20:10
question
English, 14.09.2021 20:10
question
Mathematics, 14.09.2021 20:10
question
Mathematics, 14.09.2021 20:10
Questions on the website: 13722360