private static void m3() throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter("d:/abc.txt"));
//使用BufferedReader对键盘输入流缓冲
//System.in是标准的输入设备,即键盘
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
while(line.length() >0){
bw.write(line);
bw.newLine();
line = br.readLine();
}
br.close();
bw.close();
}
使用BufferReader,使用System.in给文件输入内容,打开文件之后出现乱码?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
4条回答 默认 最新
悬赏问题
- ¥15 无法输出helloworld
- ¥15 高通uboot 打印ubi init err 22
- ¥20 PDF元数据中的XMP媒体管理属性
- ¥15 R语言中lasso回归报错
- ¥15 网站突然不能访问了,上午还好好的
- ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
- ¥15 semrush,SEO,内嵌网站,api
- ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
- ¥15 振荡电路,ADS仿真
- ¥15 关于#c语言#的问题,请各位专家解答!