最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

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

public void writeFile()throws IOException
{
int i =1;
while(i<4)
{
System.out.println("請(qǐng)輸入內(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 提問者

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

舉報(bào)

0/150
提交
取消

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

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

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

幫助反饋 APP下載

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

公眾號(hào)

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