`
wanxiaotao12
  • 浏览: 453006 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Java读取文件内容并转换为字符串

 
阅读更多

String FileName="d:/2.txt";
File myFile
=new File(FileName);
if(!myFile.exists())
...{
System.err.println(
"Can't Find "+ FileName);
}


try
...{
BufferedReader in
=new BufferedReader(new FileReader(myFile));
String str;
while ((str = in.readLine()) !=null)
...{
System.out.println(str);
}

in.close();
}

catch (IOException e)
...{
e.getStackTrace();
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics