Skip to content

Commit 764a55b

Browse files
authored
when it happens, you may believe
Now I have told you before it happens so that, when it happens, you may believe (John 14:29)
1 parent 4a3f85c commit 764a55b

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

task15/task1507/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.task1507;
2+
3+
//Now I have told you before it happens so that, when it happens, you may believe (John 14:29)
4+
5+
/*
6+
ООП - Перегрузка
7+
*/
8+
9+
public class Solution {
10+
public static void main(String[] args) {
11+
printMatrix(2, 3, "8");
12+
}
13+
14+
public static void printMatrix(int m, int n, double value) {
15+
System.out.println("Заполняем объектами double");
16+
printMatrix(m, n, (Object) value);
17+
}
18+
public static void printMatrix(int m, int n, float value) {
19+
System.out.println("Заполняем объектами float");
20+
printMatrix(m, n, (Object) value);
21+
}
22+
public static void printMatrix(int m, int n, short value) {
23+
System.out.println("Заполняем объектами short");
24+
printMatrix(m, n, (Object) value);
25+
}
26+
public static void printMatrix(int m, int n, byte value) {
27+
System.out.println("Заполняем объектами byte");
28+
printMatrix(m, n, (Object) value);
29+
}
30+
public static void printMatrix(int m, int n, int value) {
31+
System.out.println("Заполняем объектами int");
32+
printMatrix(m, n, (Object) value);
33+
}
34+
public static void printMatrix(int m, int n, Integer value) {
35+
System.out.println("Заполняем объектами Integer");
36+
printMatrix(m, n, (Object) value);
37+
}
38+
public static void printMatrix(int m, int n, char value) {
39+
System.out.println("Заполняем объектами char");
40+
printMatrix(m, n, (Object) value);
41+
}
42+
public static void printMatrix(int m, int n, long value) {
43+
System.out.println("Заполняем объектами long");
44+
printMatrix(m, n, (Object) value);
45+
}
46+
47+
public static void printMatrix(int m, int n, String value) {
48+
System.out.println("Заполняем объектами String");
49+
printMatrix(m, n, (Object) value);
50+
}
51+
52+
public static void printMatrix(int m, int n, Object value) {
53+
for (int i = 0; i < m; i++) {
54+
for (int j = 0; j < n; j++) {
55+
System.out.print(value);
56+
}
57+
System.out.println();
58+
}
59+
}
60+
}
61+
62+
63+
64+
65+
/*
66+
ООП - Перегрузка
67+
Перегрузите метод printMatrix 8 различными способами. В итоге должно получиться 10 различных методов printMatrix.
68+
69+
70+
Требования:
71+
1. В классе Solution должны быть реализованы 10 методов printMatrix с различными аргументами.
72+
2. Класс Solution должен быть public.
73+
3. Все методы класса Solution должны быть статическими.
74+
4. Все методы класса Solution должны быть публичными.
75+
76+
package com.javarush.task.task15.task1507;
77+
78+
*
79+
ООП - Перегрузка
80+
*
81+
82+
public class Solution {
83+
public static void main(String[] args) {
84+
printMatrix(2, 3, "8");
85+
}
86+
87+
public static void printMatrix(int m, int n, String value) {
88+
System.out.println("Заполняем объектами String");
89+
printMatrix(m, n, (Object) value);
90+
}
91+
92+
public static void printMatrix(int m, int n, Object value) {
93+
for (int i = 0; i < m; i++) {
94+
for (int j = 0; j < n; j++) {
95+
System.out.print(value);
96+
}
97+
System.out.println();
98+
}
99+
}
100+
}
101+
102+
*/

0 commit comments

Comments
 (0)