Question: / / public class Driver { / * * * main method * / public static void main ( String [ ] args ) {
public class Driver
main method
public static void mainString args
Create a Farm of size
Farm farm new Farm;
Create Animal Objects with the details specified in the table below
Animal a new Animalcowf;
Animal a new Animalpigm;
Animal a new Animaldonkeym;
Animal a new Animalsheepf;
Animal a new Animalgoosef;
Add the Animal objects to the Farm
farm.addAnimala;
farm.addAnimala;
farm.addAnimala;
farm.addAnimala;
farm.addAnimala;
Call the printDetails method from the Farm to print all the Farm and Animal details.
farm.printAllDetails;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
