subject

Consider the following class declarations. public class Dog
{
private String name;
public Dog()
{
name = "NoName";
}
}
public class Poodle extends Dog
{
private String size;
public Poodle(String s)
{

size = s;
}
}

The following statement appears in a method in another class.
Poodle myDog = new Poodle("toy");
Which of the following best describes the result of executing the statement?

a. The Poodle variable myDog is instantiated as a Poodle. The instance variable size is initialized to "toy". The instance variable name is not assiged a value.
b. The Poodle variable myDog is instantiated as a Poodle. The instance variable size is initialized to "toy". An implicit call to the no-argument Dog constructor is made, initializing the instance variable name to "NoName".
c. The Poodle variable myDog is instantiated as a Poodle. The instance variable size is initialized to "toy". An implicit call to the no-argument Dog constructor is made, initializing the instance variable name to "toy".
d. A runtime error occurs because super is not used to call the no-argument Dog constructor.
e. A runtime error occurs because there is no one-argument Dog constructor.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Ayear in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: the year must be divisible by 4if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year.ex: if the input is 1913, the output is: 1913 is not a leap year.
Answers: 2
question
Computers and Technology, 22.06.2019 08:30
Active listen eliminates barries to communication true or false
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
You know the right answer?
Consider the following class declarations. public class Dog
{
private String name;
Questions
question
World Languages, 06.01.2020 12:31
question
Chemistry, 06.01.2020 12:31