Repository navigation
Expand file tree
/
Copy pathSolution.java
More file actions
61 lines (49 loc) · 1.69 KB
/
Copy pathSolution.java
File metadata and controls
61 lines (49 loc) · 1.69 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//Where is the wise? where is the scribe? where is the disputer of this world? has not God made foolish the wisdom of this world? (1Cor 1:20)
package com.javarush.task.task25.task2501;
/*
Новые возможности!
*/
public class Solution {
public static void main(String[] args) {
System.out.println(Alphabet.G.getLetterPosition());
}
public enum Alphabet {
A, B, C, D, E,
F, G, H, I, J,
K, L, M, N, O,
P, Q, R, S, T,
U, V, W, X, Y, Z;
int getLetterPosition() {
return ordinal()+1;
}
}
}
/*
Новые возможности!
Используя возможности enum-а реализуй метод getLetterPosition, который должен возвращать позицию буквы.
Позиция буквы A — 1.
Требования:
1. Класс Solution должен содержать enum Alphabet.
2. Alphabet должен содержать по порядку 26 букв английского алфавита.
3. Метод getLetterPosition у класса Alphabet должен возвращать позицию буквы в алфавите.
4. Метод getLetterPosition должен вызывать метод ordinal.
package com.javarush.task.task25.task2501;
*
Новые возможности!
*
public class Solution {
public static void main(String[] args) {
System.out.println(Alphabet.G.getLetterPosition());
}
public enum Alphabet {
A, B, C, D, E,
F, G, H, I, J,
K, L, M, N, O,
P, Q, R, S, T,
U, V, W, X, Y, Z;
int getLetterPosition() {
return -1;
}
}
}
*/