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.