Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need the code to store 5 objects in a file every time the application is loaded.
Posted

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Mar-12 23:10pm    
My 5.
--SA
ProEnggSoft 19-Mar-12 23:14pm    
Thank you
If this object is String, Int, Char or etc...
and putting it to a file(Text File) you can use this

Java
import java.io.*;

public class WriteTextFileExample{
  public static void main(String[] args)throws IOException{
  Writer output = null;
  File file = new File("write.txt");
  output = new BufferedWriter(new FileWriter(file));
  output.write("Sample Text");
  output.close();
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900