I have a Person object with 5 variables and I want to store
them in a file called Person.txt. What should I do?

Answers were Sorted based on User's Feedback



I have a Person object with 5 variables and I want to store them in a file called Person.txt. What ..

Answer / s.ramesh

We have to implement serializable interface

Is This Answer Correct ?    2 Yes 0 No

I have a Person object with 5 variables and I want to store them in a file called Person.txt. What ..

Answer / srinu

we have imlpement ur class with java.lang.Serializible
interface and used the following steps
1)ObjectOutPutStream class(one method is their write objects
into file)
(a)writeObject(Object obj) -------> writing for objects
into file.This process is called Serializtion.

2)ObjectInputStream class reading the objects from file
(a)readObject(Object obj)---------> Reading objects from
fole This process is called Deserialization.

Is This Answer Correct ?    2 Yes 0 No

I have a Person object with 5 variables and I want to store them in a file called Person.txt. What ..

Answer / puneet

outpurstreamobject.writeobject(object o);
flush//;
close//;

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

Is integer a class?

0 Answers  


How can I become a good programmer?

0 Answers  


Is passing by reference faster?

0 Answers  


Can variables be used in java without initialization?

0 Answers  


Explain what are final variable in java?

0 Answers  






class test { private static void main(String []adsf) { } } explain me that the above code is error or exception

3 Answers  


what is jdk1.5 features?

6 Answers   AMS, Virtusa,


What is the java idl system?

0 Answers  


a thread is runnable, how does that work? : Java thread

0 Answers  


Which is easier .net or java?

0 Answers  


Wha is the output from system.out.println(“hello”+null); ?

0 Answers  


What is the nested interface?

0 Answers  


Categories