this is what i have coded so far
public class Animals {
public static void main(String args[]){
Dog dog = new Dog();
dog.setAnimalType("dog");
Cat cat = new Cat();
cat.setAnimalType("cat");
Fish fish = new Fish();
fish.setAnimalType("fish");
}
public static void displayObject(Dog dog, Cat cat, Fish fish){
System.out.println("this a " +dog.getAnimalType());
System.out.println("this a " +cat.getAnimalType());
System.out.println("this a " +fish.getAnimalType());
}
}
this is one of the classes dog cat and fish look the same
public class Dog {
public String animaltype1;
public String getAnimalType(){
return animaltype1;
}
public void setAnimalType(String name){
animaltype1 = name;
}
}