Create the Inheritance Java program of the problem below.
SUPERCLASS
*Create a Class "Pet"
*Instance petName (MODIFIER IS Public)
*Create a Constructor
Mutator
Accessor
speak() ["I'm your cuddly little pet."]
SUBCLASS
Bird
*Create a Method
speak() ["I speak only when I want to."]
Duck
*Create a Method
speak() ["Kwak Kwak"]
MAIN
OUTPUT:
I'm your cuddly little pet. ---OBJECT FOR PET
Hi, my name is Cha Cha ---OBJECT FOR CAT
I speak only when I want to. ---OBJECT FOR CAT
Create the Inheritance Java program of the problem below. SUPERCLASS *Create a Class "Pet" *Instance petName (MODIFIER
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am