62,614
社区成员
发帖
与我相关
我的任务
分享
InputStream in = new FileInputStream("Demo.txt");
Properties p = new Properties();
p.load(in);
p.setProperty("dd","3000");
OutputStream out = new FileOutputStream("Demo.txt");
p.store(out,"sdf");
System.out.println(p);
out.close();
in.close();
OutputStream out = new FileOutputStream("Demo.txt");
InputStream in = new FileInputStream("Demo.txt");
Properties p = new Properties();
p.load(in);
p.setProperty("dd","3000");
p.store(out,"sdf");
System.out.println(p);
out.close();
in.close();
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new FileReader("Demo.txt"));
OutputStream out = new FileOutputStream("Demo.txt");
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
out.close();
}
[/quote]
写成OutputStream out = new FileOutputStream("Demo.txt", true);
就行了,学习了。[/quote]
纯粹添乱啊。变成appending只是让事情变得更加复杂 public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new FileReader("Demo.txt"));
OutputStream out = new FileOutputStream("Demo.txt");
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
out.close();
}
[/quote]
写成OutputStream out = new FileOutputStream("Demo.txt", true);
就行了,学习了。 public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new FileReader("Demo.txt"));
OutputStream out = new FileOutputStream("Demo.txt");
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
out.close();
}