-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出力を書くつもりです –