Skip to content

Commit 0e1b407

Browse files
authored
he knew him who would betray him
For he knew him who would betray him, therefore he said, "You are not all clean." (John 13:11)
1 parent 1eb6dba commit 0e1b407

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎task12/task1204/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.task1204;
2+
3+
//For he knew him who would betray him, therefore he said, "You are not all clean." (John 13:11)
4+
5+
/*
6+
То ли птица, то ли лампа
7+
*/
8+
9+
public class Solution {
10+
public static void main(String[] args) {
11+
printObjectType(new Cat());
12+
printObjectType(new Bird());
13+
printObjectType(new Lamp());
14+
printObjectType(new Cat());
15+
printObjectType(new Dog());
16+
}
17+
18+
public static void printObjectType(Object o) {
19+
if (o instanceof Cat) {System.out.println("Кошка");} //Напишите тут ваше решение
20+
else if (o instanceof Dog) {System.out.println("Собака");}
21+
else if (o instanceof Bird) {System.out.println("Птица");}
22+
else if (o instanceof Lamp) {System.out.println("Лампа");}
23+
}
24+
25+
public static class Cat {
26+
}
27+
28+
public static class Dog {
29+
}
30+
31+
public static class Bird {
32+
}
33+
34+
public static class Lamp {
35+
}
36+
}

0 commit comments

Comments
 (0)