Question: Declare a public class named Elephant and declare two private instance variables named height and weight in the class. Both variables are of type double.
Declare a public class named Elephant and declare two private instance variables named height and weight in the class. Both variables are of type double. Declare a default constructor which initializes the variables to 0.0, then declare an overloaded constructor which accepts two double parameters representing the height and weight of the Elephant object. In the overloaded constructor initialize the instance variables using those parameters.
No main method, accessors, or mutators are required for this problem.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
