第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

問大家一段代碼,代碼如下,目的是寫入三行文字

public void writeFile()throws IOException
{
int i =1;
while(i<4)
{
System.out.println("請輸入內(nèi)容");
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
byte[] b = str.getBytes();
//String newline = System.getProperty("line.separator");
FileOutputStream out = new FileOutputStream("/Users/a/Documents/workspace/I.O/src/a.txt",true);
//out.write(newline.getBytes());
out.write(b);
//System.out.println();
out.flush();
out.close();
++i;



}
}
public static void main(String[] args)
{
try{
new Exam1().writeFile();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}

正在回答

1 回答

是問這段代碼有沒有問題嗎,你這樣寫進(jìn)去的文字應(yīng)該是亂碼吧

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

lynhao 提問者

打錯了 是輸入內(nèi)容,我知道中文會亂碼,我其實(shí)是想問放進(jìn)去的內(nèi)容如何分行
2015-05-25 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

問大家一段代碼,代碼如下,目的是寫入三行文字

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號