-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
36 lines (29 loc) · 804 Bytes
/
Solution.java
File metadata and controls
36 lines (29 loc) · 804 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.task1203;
//Jesus said to him, "Someone who has bathed only needs to have his feet washed,
//but is completely clean. You are clean, but not all of you." (John 13:10)
/*
Кесарю — кесарево
*/
public class Solution {
public static void main(String[] args) {
Pet pet1 = new Cat();
Pet cat = pet1.getChild();
Pet pet2 = new Dog();
Pet dog = pet2.getChild();
}
public static class Pet {
public Pet getChild() {
return new Pet();
}
}
public static class Cat extends Pet {
public Cat getChild() {
return new Cat();
}
}
public static class Dog extends Pet {
public Dog getChild() {
return new Dog();
}
}
}