Skip to content

Commit 617d2e5

Browse files
authored
Do you know what I have done to you?
So when he had washed their feet, put his outer garment back on, and sat down again, he said to them, "Do you know what I have done to you? (John 13:12)
1 parent 0e1b407 commit 617d2e5

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎task12/task1205/Solution.java‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.javarush.task.task12.task1205;
2+
3+
//So when he had washed their feet, put his outer garment back on,
4+
//and sat down again, he said to them, "Do you know what I have done to you? (John 13:12)
5+
6+
/*
7+
Определимся с животным
8+
*/
9+
10+
public class Solution {
11+
public static void main(String[] args) {
12+
System.out.println(getObjectType(new Cow()));
13+
System.out.println(getObjectType(new Dog()));
14+
System.out.println(getObjectType(new Whale()));
15+
System.out.println(getObjectType(new Pig()));
16+
}
17+
18+
public static String getObjectType(Object o) {
19+
if (o instanceof Cow) {return "Корова";}//Напишите тут ваше решение
20+
else if (o instanceof Whale) {return "Кит";}
21+
else if (o instanceof Dog) {return "Собака";}
22+
else return "Неизвестное животное";
23+
}
24+
25+
public static class Cow {
26+
}
27+
28+
public static class Dog {
29+
}
30+
31+
public static class Whale {
32+
}
33+
34+
public static class Pig {
35+
}
36+
}

0 commit comments

Comments
 (0)