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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:00, 19youngr
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
image
Computers and Technology, 23.06.2019 09:30, Princessirisperez0
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e. g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
image
Computers and Technology, 23.06.2019 13:10, BrianKeokot4534
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
image
Computers and Technology, 24.06.2019 15:50, coralaguilar1702
Andy would like to create a bulleted list. how should he do this? andy should click on the bullet icon or select the bullet option from the menu and then type the list. andy should press the shift key and the 8 key at the beginning of each line of text. andy should type the text and then click on the bullet command. andy should press return and the bullets will automatically
Answers: 2
You know the right answer?
Consider the following class declarations. public class Publication
{
private String ti...

Questions in other subjects:

Konu
English, 03.06.2021 01:00
Konu
History, 03.06.2021 01:00
Konu
Mathematics, 03.06.2021 01:00
Konu
English, 03.06.2021 01:00