日期:2014-05-20 浏览次数:20724 次
[color=#FF0000]4gg/iaIwlXrhfN2FAPjYXhRqOAj3GHesbw1bniOu7Xo=[/color]
String key=""; try { FileReader fer = new FileReader("key.data"); BufferedReader ber = new BufferedReader(fer); while(ber.read()!= -1) { key = ber.readLine(); } ber.close(); System.out.println(key); }
String key=""; try { FileReader fer = new FileReader(keyFile); BufferedReader ber = new BufferedReader(fer); while((key=ber.readLine())==null){break;} ber.close(); }
String key = ""; try { FileReader fer = new FileReader("1.txt"); BufferedReader ber = new BufferedReader(fer); do{ key+=ber.readLine(); }while(ber.read()!=-1); ber.close(); System.out.println(key); } catch (Exception e) { e.printStackTrace(); }
------解决方案--------------------
Java code
String key="";
try
{
FileReader fer = new FileReader("key.data");
BufferedReader ber = new BufferedReader(fer);
while(ber.read()!= -1)
{
key += ber.readLine();//这是一个自相加的
}
ber.close();
System.out.println(key);
}