日期:2014-05-20 浏览次数:20700 次
import java.io.*; public class Test2 { private static String readStringFromFile(String filename) throws IOException { BufferedReader rd = new BufferedReader(new FileReader(filename)); String line; StringBuilder result = new StringBuilder(); while((line = rd.readLine()) != null) { result.append(line); result.append(" "); } return result.toString(); } public static void main(String[] args) throws IOException { System.out.println(readStringFromFile("E:\\LICENSE.txt")); } }
------解决方案--------------------
楼上很好解决黎你这个问题
------解决方案--------------------