Question
JAVA HOMEWORK Question 1: Describing Inheritance Rules In your own words, describe the following: 1.What are the rules for accessing public, private, and protected variables
JAVA HOMEWORK
Question 1: Describing Inheritance Rules
In your own words, describe the following:
1.What are the rules for accessing public, private, and protected variables declared in a parent class from the child class?
2.What are the two uses of the super keyword?
3.When and how do you override a method?
Question 2: Design a Parent/Child Class
Design classes to represent an animal, a dog, and a cat. (Perhaps to be used in a veterinary hospital or pet boarding center). Sketch out the following. (You do not need to write the code.)
What are the parent/child relationships between the classes?
What instance data variables belong in each class (list the name and type)?
What methods would go in each class (list the name, return type, and parameter list)?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started