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

What is an iterator interface in java programming?

0 Answers  


Can you make a constructor final?

0 Answers  


What is difference between this and super keyword?

0 Answers  


Difference between object instantiation and construction ?

0 Answers  


Is vector ordered in java?

0 Answers  






How does hashset work in java?

0 Answers  


What is Mutex (Mutual Exclusion Object) ?

0 Answers   Ciena,


diff. b/w JAVA and javascript...

3 Answers   NIIT,


What is a java applet? What is an interface?

0 Answers  


Which method is used to find that the object is exited or not?

2 Answers  


What is exception hierarchy in java?

0 Answers  


What is treemap in java?

0 Answers  


Categories