-3
열 단지 단어를 얻을 수서식 문자열 내가 텍스트가
c
MyMP3s
4
Non
Blindes
Bigger
Faster
More
Train
mp3
그리고 이것 모두를 파일에 써라. 다음은 내가 한 일입니다.
public static void formatText() throws IOException{
Writer writer = null;
BufferedReader br = new BufferedReader(new FileReader(new File("File.txt")));
String line = "";
while(br.readLine()!=null){
System.out.println("Into the loop");
line = br.readLine();
line = line.replaceAll(":", " ");
line = line.replaceAll(".", " ");
line = line.replaceAll("_", " ");
line = System.lineSeparator();
System.out.println(line);
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("Write.txt")));
writer.write(line);
}
그리고 작동하지 않습니다!
예외 : 코드의 끝에
Into the loop
Exception in thread "main" java.lang.NullPointerException
at Application.formatText(Application.java:25)
at Application.main(Application.java:41)
라인 + = System.lineSeparator()'과 같은 의미입니까?;'? –
프로그램의 출력물을 게시 할 수 있습니까? – SteelToe
@ PM77-1 출력을 쓰겠습니다 –