-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProb03_stream.java
More file actions
47 lines (39 loc) · 1.21 KB
/
Copy pathProb03_stream.java
File metadata and controls
47 lines (39 loc) · 1.21 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
package java0911_stream.prob;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.Iterator;
import java.util.stream.Stream;
/*
* [문제]
* sun.txt파일에서 데이터를 읽어온후 ‘\t’와 ‘ ‘을 ‘-‘ 로 변환하여
* 프로그램을 구현하시오.
*
* [프로그램 실행결과]
* hello-world-!!!
* java-programming
* jsp-servlet-programming!
*/
public class Prob03_stream {
public static void main(String args[]) {
String[] lines = readLines(".\\src\\java0911_stream\\prob\\sun.txt");
for (int i = 0; i < lines.length; i++) {
printLine(lines[i]);
}
}
public static String[] readLines(String fileName) {
/*
* 파라미터로 전달받은 txt파일을 읽어 들여, 파일의 줄 수에 해당하는 String[]을 생성하여 해당 String[]에 한
* 라인씩 저장해서 반환한다.
*/
return null;
}// end readLines()
public static void printLine(String line) {
/*
* 문자열을 받아들여 ‘\t’와 ‘ ‘을 ‘-‘ 로 변환하여 콘솔에 출력한다.
*/
}// end printLine()
}// end class