package de.codegym.task.task12.task1205;
/*
Tiere erkennen
*/
public class Solution {
public static void main(String[] args) {
System.out.println(getObjectType(new Cow()));
System.out.println(getObjectType(new Whale()));
System.out.println(getObjectType(new Pig()));
System.out.println(getObjectType(new Dog()));
}
public static String getObjectType(Object o) {
//schreib hier deinen Code
String s;
if(o instanceof Cow){
s = "Kuh";
}
else if(o instanceof Dog){
s = "Hund";
}
else if(o instanceof Whale){
s = "Wahl";
}
else{
s = "Unbekanntes Tier";
}
return s;
}
public static class Cow {
}
public static class Dog {
}
public static class Whale {
}
public static class Pig {
}
}