-1

Is there any way through which we can write the response from GUI(I was updating some data into a text box) into a file(In any format) using java code.

I am updating some values in GUI and in our java code I want to get all that data and store it into a file.

Prax
  • 91
  • 3
  • 12
  • Possible duplicate of [How to create a file and write to a file in Java?](http://stackoverflow.com/questions/2885173/how-to-create-a-file-and-write-to-a-file-in-java) – fabian Sep 17 '16 at 09:16
  • Its related to DB not a simple java program. – Prax Sep 17 '16 at 10:18

1 Answers1

1

Yes you can write objects into a file.ser (serialized file). Below is an example of how to write to a file using FOS.

FileOutputStream fout = new FileOutputStream("c:\\object.ser");
    ObjectOutputStream oos = new ObjectOutputStream(fout);
    Objec Obj ;
    oos.writeObject(Obj);
    oos.close();
HasS
  • 201
  • 1
  • 17
  • can we update the same content into DB?? If Yes, could you please help me out to perform this task. – Prax Sep 17 '16 at 09:44
  • Dealing with databases is much more complex than just writing an Object into a file. But when you have large data to store , RDBMS is recommanded because it simplifies the work to be done. So if you have small data to deal with , just read and write into a file. If you're dealing with huge data to be stored than i suggest using RDBMS . – HasS Sep 17 '16 at 09:48
  • I can help you yes , but , give me an email address – HasS Sep 17 '16 at 09:59