Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA - Type the program's output: public class TestAnimal { public static void main ( String [ ] args ) { Domestic myDomestic = new
JAVA
Type the program's output:
public class TestAnimal
public static void mainString args
Domestic myDomestic new DomesticSpot "James";
Wild myWild new WildSimba "Lion";
myDomestic.printInfo;
System.out.println;
myWild.printInfo;
public abstract class Animal
protected String name;
protected int age;
abstract void printInfo;
public String getNameAndAge
return this.age years, name;
public class Domestic extends Animal
private String owner;
public DomesticString domesticName, int domesticAge, String domesticOwner
this.name domesticName;
this.age domesticAge;
this.owner domesticOwner;
public void printInfo
String nameAndAge this.getNameAndAge;
System.out.printlnnameAndAge;
System.out.printlnOwner: this.owner;
public class Wild extends Animal
private String species;
public WildString wildName, int wildAge, String wildSpecies
this.name wildName;
this.age wildAge;
this.species wildSpecies;
public void printInfo
String nameAndAge this.getNameAndAge;
System.out.printlnnameAndAge;
System.out.printlnSpecies: this.species;
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