Skip to content

Commit ce9eba6

Browse files
authored
keep my commandments, you will remain in my love
If you keep my commandments, you will remain in my love; even as I have kept my Father's commandments, and remain in his love. (John 15:10)
1 parent c72353c commit ce9eba6

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

task15/task1526/Solution.java

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.javarush.task.task15.task1526;
2+
3+
//If you keep my commandments, you will remain in my love; even as I have kept my Father's commandments,
4+
//and remain in his love. (John 15:10)
5+
6+
/*
7+
Дебаг, дебаг, и еще раз дебаг
8+
*/
9+
10+
public class Solution {
11+
public static void main(String[] args) {
12+
new B(6);
13+
}
14+
15+
public static class A {
16+
private int f1 = 7;
17+
18+
public A(int f1) {
19+
this.f1 = f1;
20+
initialize();
21+
}
22+
23+
private void initialize() {
24+
System.out.println(f1);
25+
}
26+
}
27+
28+
public static class B extends A {
29+
protected int f1 = 3;
30+
31+
public B(int f1) {
32+
super(f1);
33+
this.f1 += f1;
34+
initialize();
35+
}
36+
37+
protected void initialize() {
38+
System.out.println(f1);
39+
}
40+
}
41+
}
42+
43+
44+
45+
46+
47+
/*
48+
Дебаг, дебаг, и еще раз дебаг
49+
Программа выводит 0 9, а должна 6 9. Найди одну! ошибку и исправь.
50+
Используй дебаг. Для этого поставь breakpoint-ы(Ctrl+F8), потом зайди в меню Run -> Debug.
51+
F9 — выполнение кода до следующего breakpoint-а
52+
F8 — переход к следующей строке кода
53+
54+
55+
Требования:
56+
1. Программа должна выводить данные на экран.
57+
2. Вывод на экран должен соответствовать условию задачи.
58+
3. Метод initialize в классе A должен иметь самый строгий модификатор доступа.
59+
4. Программа не должна считывать данные с клавиатуры.
60+
61+
62+
package com.javarush.task.task15.task1526;
63+
64+
*
65+
Дебаг, дебаг, и еще раз дебаг
66+
*
67+
68+
public class Solution {
69+
public static void main(String[] args) {
70+
new B(6);
71+
}
72+
73+
public static class A {
74+
private int f1 = 7;
75+
76+
public A(int f1) {
77+
this.f1 = f1;
78+
initialize();
79+
}
80+
81+
protected void initialize() {
82+
System.out.println(f1);
83+
}
84+
}
85+
86+
public static class B extends A {
87+
protected int f1 = 3;
88+
89+
public B(int f1) {
90+
super(f1);
91+
this.f1 += f1;
92+
initialize();
93+
}
94+
95+
protected void initialize() {
96+
System.out.println(f1);
97+
}
98+
}
99+
}
100+
101+
102+
*/

0 commit comments

Comments
 (0)