Skip to content

Commit c78e3ba

Browse files
authored
we are the Lord's
For if we live, we live to the Lord. Or if we die, we die to the Lord. If therefore we live or die, we are the Lord's. (Romans 14:8)
1 parent 76668e4 commit c78e3ba

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

task14/task1403/Solution.java

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package com.javarush.task.task14.task1403;
2+
3+
//For if we live, we live to the Lord. Or if we die, we die to the Lord.
4+
//If therefore we live or die, we are the Lord's. (Romans 14:8)
5+
6+
/*
7+
Building и School
8+
*/
9+
10+
public class Solution {
11+
public static void main(String[] args) {
12+
Building school = getSchool();
13+
Building shop = getBuilding();
14+
15+
System.out.println(school);
16+
System.out.println(shop);
17+
}
18+
19+
public static Building getSchool() {
20+
//измените null на объект класса Building или School
21+
return new School();
22+
}
23+
24+
public static Building getBuilding() {
25+
//измените null на объект класса Building или School
26+
return new Building();
27+
}
28+
29+
static class School extends Building /*Добавьте сюда ваш код*/ {
30+
@Override
31+
public String toString() {
32+
return "School";
33+
}
34+
}
35+
36+
static class Building /*Добавьте сюда ваш код*/ {
37+
@Override
38+
public String toString() {
39+
return "Building";
40+
}
41+
}
42+
}
43+
44+
45+
46+
/*
47+
Building и School
48+
1. Расставь правильно наследование между Building(здание) и School(здание школы).
49+
2. Подумай, объект какого класса должен возвращать методы getSchool и getBuilding.
50+
3. Измени null на объект класса Building или School.
51+
52+
53+
Требования:
54+
1. Класс School должен наследоваться от класса Building.
55+
2. Метод getSchool должен возвращать новую школу(School).
56+
3. Метод getBuilding должен возвращать новое здание(Building).
57+
4. Класс School должен быть статическим.
58+
5. Класс Building должен быть статическим.
59+
60+
package com.javarush.task.task14.task1403;
61+
62+
*
63+
Building и School
64+
*
65+
66+
public class Solution {
67+
public static void main(String[] args) {
68+
Building school = getSchool();
69+
Building shop = getBuilding();
70+
71+
System.out.println(school);
72+
System.out.println(shop);
73+
}
74+
75+
public static Building getSchool() {
76+
//измените null на объект класса Building или School
77+
return null;
78+
}
79+
80+
public static Building getBuilding() {
81+
//измените null на объект класса Building или School
82+
return null;
83+
}
84+
85+
static class School /*Добавьте сюда ваш код*/ {
86+
@Override
87+
public String toString() {
88+
return "School";
89+
}
90+
}
91+
92+
static class Building /*Добавьте сюда ваш код*/ {
93+
@Override
94+
public String toString() {
95+
return "Building";
96+
}
97+
}
98+
}
99+
*/

0 commit comments

Comments
 (0)