-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
36 lines (28 loc) · 989 Bytes
/
Solution.java
File metadata and controls
36 lines (28 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.javarush.task.task12.task1204;
//For he knew him who would betray him, therefore he said, "You are not all clean." (John 13:11)
/*
То ли птица, то ли лампа
*/
public class Solution {
public static void main(String[] args) {
printObjectType(new Cat());
printObjectType(new Bird());
printObjectType(new Lamp());
printObjectType(new Cat());
printObjectType(new Dog());
}
public static void printObjectType(Object o) {
if (o instanceof Cat) {System.out.println("Кошка");} //Напишите тут ваше решение
else if (o instanceof Dog) {System.out.println("Собака");}
else if (o instanceof Bird) {System.out.println("Птица");}
else if (o instanceof Lamp) {System.out.println("Лампа");}
}
public static class Cat {
}
public static class Dog {
}
public static class Bird {
}
public static class Lamp {
}
}