-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
66 lines (45 loc) · 2.6 KB
/
Copy pathSolution.java
File metadata and controls
66 lines (45 loc) · 2.6 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
62
63
64
65
66
//And the Spirit and the bride say, Come. And let him that heareth say, Come. And let him that is athirst come.
//And whosoever will, let him take the water of life freely. (Revelation 22:17)
package com.javarush.task.task29.task2902;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
/*
Рефакторинг в соответствии с Naming and Code Convention 2
*/
public class Solution {
public static void main(String[] args) throws IOException, InterruptedException {
Solution solution = new Solution();
String fileNameToBeOpenedByNotepad = solution.getAbsolutePathToDefaultTxtFile().toString();
Process notepad = solution.getProcessStartNotepad(fileNameToBeOpenedByNotepad);
notepad.waitFor();
}
public Process getProcessStartNotepad(String fileName) throws IOException {
String[] cmdArray = new String[]{"notepad.exe", fileName};
return Runtime.getRuntime().exec(cmdArray);
}
public Path getAbsolutePathToDefaultTxtFile() {
URI uri = null;
try {
uri = Solution.class.getResource("file.txt").toURI();
} catch (URISyntaxException e) {
e.printStackTrace();
}
return Paths.get(uri);
}
}
/*
Рефакторинг в соответствии с Naming and Code Convention 2
Исправить код в соответствии с Naming and Code Convention (Shift+F6 для рефакторинга).
Требования:
1. Переименуй переменную Solution типа Solution в соответствии с Naming and Code Convention.
2. Переименуй переменную file_name_to_be_opened_by_notepad типа String в соответствии с Naming and Code Convention.
3. Переименуй переменную NOTEPAD типа Process в соответствии с Naming and Code Convention.
4. Переименуй метод getprocessstartnotepad в соответствии с Naming and Code Convention.
5. Переименуй параметр FILE_NAME метода принимающего String в соответствии с Naming and Code Convention.
6. Переименуй переменную cmd_array типа String[] в соответствии с Naming and Code Convention.
7. Переименуй метод Getabsolutepathtodefaulttxtfile в соответствии с Naming and Code Convention.
8. Переименуй переменную uRi типа URI в соответствии с Naming and Code Convention.
*/