subject

Consider the following class declarations. public class Publication
{
private String title;

public Publication()
{
title = "Generic";
}

public Publication(String t)
{
title = t;
}
}

public class Book extends Publication
{
public Book()
{
super();
}
public Book(String t)
{
super(t);
}
}
The following code segment appears in a method in another class.

Book myBook = new Book("Adventure Story"); // Line 1
Book yourBook = new Book(); // Line 2

Which of the following best describes the result of executing the code segment?

a. Object myBook is created using the one-argument Book constructor, which uses super to set myBook’s title attribute to "Adventure Story". Object yourBook is created using the Book constructor, which uses super to set yourBook’s title attribute to an empty string.
b. Object myBook is created using the no-argument Book constructor, which uses super to set myBook’s title attribute to "Generic". Object yourBook is created using super to call to the Publication no-argument constructor to set yourBook’s title attribute to "Generic".
c. Object myBook is created using the one-argument Book constructor, which uses super to set myBook’s title attribute to "Adventure Story". Object yourBook is created using super to call to the Publication no-argument constructor to set yourBook’s title attribute to "Generic".
d. A runtime error occurs in line 1 because the one-argument Publication constructor cannot be called from the one-argument Book constructor.
e. A runtime error occurs in line 2 because the no-argument Publication constructor cannot be called from the no-argument Book constructor.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:31
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
question
Computers and Technology, 24.06.2019 07:00
Jean has kept the content of her website limited to what is important; she has also ensured that the text follows a particular style and color all throughout her website. which website features has jean kept in mind? jean has limited the content of her website to what is important; this ensures (clarity, simplicity, harmony and unity) of the content. she has also formatted the text in a particular style and color throughout her website, ensuring (balance, simplicity, consistency)
Answers: 2
question
Computers and Technology, 24.06.2019 10:50
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
You know the right answer?
Consider the following class declarations. public class Publication
{
private String ti...
Questions
question
Mathematics, 10.09.2020 17:01
question
World Languages, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Health, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
question
Mathematics, 10.09.2020 17:01
Questions on the website: 13722361