Question: Given the provided main ( ) method, create two ( 2 ) static classes inside of the HouseholdPets class. ( 1 ) Create HouseholdPetclass Declare

Given the provided main() method, create two (2) static classes inside of the HouseholdPets class.
(1) Create HouseholdPetclass
Declare a String field called name (do not assign it a value and do not make it private)
Create a public constructor that takes in a String, and sets the field here.
Create a public method called describe() that prints out the following string:
"This pet's name is "+
this.name +"."
(2) Create DogPet class that extends HouseholdPet
Declare a String field called sound
Create a public constructor that takes in a String, and sets the field here. Use the super keyword to inherit the field name from HouseholdPet, like so: super(name);
Create a public void method for DogPet called describe() that prints the following:
System.out.println("This dog's name is "+
this.name +", amd they "+ this. sound +"."); In java
 Given the provided main() method, create two (2) static classes inside

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!