0
我試圖讓BufferedWriter打印幾個字符串,每個在文本文件中的不同行上。我試圖用out.newLine()
設置爲下一個字符串的新線,但我得到的cannot find symbol - method newLine()
BufferedWriter newLine方法未找到
此錯誤消息是代碼我想使用:
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(start+"2"+dest+".txt"), "utf-8")); // create output file from start names
out.write(outputOne);//Write Line 1
out.newLine();
out.write(outputTwo); //Write Line 2
out.newLine();
out.write(outputThree); //Write Line 3
out.newLine();
out.write(outputFour); //Write Line 4
out.close();
} catch (IOException ex) { //Handle Errors
System.err.println("Error in BufferedWriter, IOException");
} finally {
try {out.close();}
catch(Exception ex) {}
}