Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java write to a file

import java.io.FileWriter;   
import java.io.IOException;
...
//write to file
try{
    FileOutputStream writeData = new FileOutputStream("peopledata.ser");
    ObjectOutputStream writeStream = new ObjectOutputStream(writeData);

    writeStream.writeObject(people);
    writeStream.flush();
    writeStream.close();

}catch (IOException e) {
    e.printStackTrace();
}
 
PREVIOUS NEXT
Tagged: #java #write #file
ADD COMMENT
Topic
Name
1+7 =