Question: IN JAVA Derive a class Lizard from Reptile (Reptile & Vertebrate is provided to you) with private data members as int lizardLength, String lizardLocation. (lizardLocation
IN JAVA
Derive a class Lizard from Reptile (Reptile & Vertebrate is provided to you) with private data members as int lizardLength, String lizardLocation. (lizardLocation values could be tropical, dry, cold etc.). Add a 4 argument constructor in this class to initialize values of brainSize, eggSize, lizardLength & lizardLocation. Override the toString method in this class and make it return all the 4 data members as String. Now create a driver class and a main method to create an object by initializing values for member data. Print this object using toString() method. Output shall look like: brain size = 0.9 egg size = 4.0 lizardLength = 10 lizardLocation = tropical


public class Vertebrate private double brainSize; public Vertebrate (double brainsize) this.brainSize- brainSize; //in cubic centimeters public String toString() return "brain size: "this.brainsize
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
