FileWriter fw = new FileWriter(File.....);
fw.write("......");
.....
fw.flush();
fw.close();应该ok

解决方案 »

  1.   

    FileOutputStream(String name,boolean append)
    FileOutputStream fos = new FileOutputStream("test.txt",true);
      

  2.   

    sorry ,看错问题了,我再找找看
      

  3.   

    //append - if true, then bytes will be written to the end of the file rather than the beginning
    FileOutputStream public FileOutputStream(String name,
                            boolean append)
                     throws FileNotFoundException 
    Creates an output file stream to write to the file with the specified name. If the second argument is true, then bytes will be written to the end of the file rather than the beginning. A new FileDescriptor object is created to represent this file connection. First, if there is a security manager, its checkWrite method is called with name as its argument. 
    If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown.
    Parameters:
    name - the system-dependent file name
    append - if true, then bytes will be written to the end of the file rather than the beginning
      

  4.   

    不行啊![DEFAULT]
    Name = 
    State = 我现在要向 Name 的后面加一个值! 怎么半啊?
      

  5.   

    FileOutputStream(String name,boolean append)
    FileOutputStream fos = new FileOutputStream("test.txt",true);
                                                           ****
    append 标志位设为 true 为加入到文件后
      

  6.   

    FileOutputStream(String name,boolean append)
    FileOutputStream fos = new FileOutputStream("test.txt",true);
                                                           ****
    append 标志位设为 true 为加入到文件后
      

  7.   

    我认为如果数据量小的话,就直接覆盖好了。
    要不然定位到Name也是比较麻烦的。
      

  8.   

    看看configProperty中有没有相应的操作。
      

  9.   

    用Properties
    import java.util.*;
    import java.io.*;public class Test {
    public static void main(String[] args) {
    try {
    Properties p = new Properties();
    FileInputStream in = new FileInputStream("test.txt");
    p.load(in);
    in.close();
    System.out.println(p.getProperty("Name"));
    } catch(Exception e) {
    System.out.println(e.getMessage());
    }
    }
    }
      

  10.   

    import java.util.*;
    import java.io.*;public class Test {
    public static void main(String[] args) {
    try {
    Properties p = new Properties();
    FileInputStream in = new FileInputStream("test.txt");
    p.load(in);in.close();System.out.println(p.getProperty("Name"));
    *********************************************// Set Name's valuep.setProperty("Name", "456");
    System.out.println(p.getProperty("Name"));*********************************************} catch(Exception e) {
    System.out.println(e.getMessage());
    }
    }
    }
      

  11.   

    java 里有一个对文件进行随机读写的类,你可以用它对文件进行你想要地操
    作,具体的类叫RadomAccessFile。很简单,你看看API把
      

  12.   

    import java.util.*;
    import java.io.*;public class Test {
    public static void main(String[] args) {try {
    Properties p = new Properties();
    FileInputStream in = new FileInputStream("test.txt");
    p.load(in);
    FileOutputStream out = new FileOutputStream("test.txt");
    Enumeration enum = p.propertyNames();
    while(enum.hasMoreElements()) {
    String s = enum.nextElement().toString();
    if(s.equals("Name")) {
    //#####################################
    // Name is the Key you want to change
    // 789 is the new value you want to set
    p.setProperty("Name", "789");
    //#####################################
    }
    else {
    //#####################################
    // Remain orgin value
    p.setProperty(s, p.getProperty(s));
    //#####################################
    }}in.close();
    p.store(out, "Test");
    } catch(Exception e) {
    System.out.println(e.getMessage());
    }
    }
    }
      

  13.   

    File f=new File("test.log");
    PrintWriter out=new PrintWriter(new FileWriter(f.getName(),true),true);记得给分
      

  14.   

    to :samsult(大牙) 是这样吗? 好象不行File f=new File("G:\\test.txt");
    PrintWriter out=
       new PrintWriter(new FileWriter(f.getName),true),true);out.write("AAAA");
    out.flush();
    out.close();
      

  15.   

    to :samsult(大牙) 是这样吗? 好象还是不行(没反映)File f=new File("G:\\test.txt");
    PrintWriter out=
        new PrintWriter(new FileWriter(f.getName(),true),true);
    out.println("aaaa");
    out.flush();
    out.close();