I have a Person object with 5 variables and I want to store
them in a file called Person.txt. What should I do?
Answer Posted / 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 |
Post New Answer View All Answers
What is string buffer?
Why can't we use static class instead of singleton?
What are the differences between c++ and java?
What is a condition in java?
How many types of memory areas are allocated by JVM in java?
What is the difference between abstract class and interface1? What is an interface?
Explain the difference between jdk, jre, and jvm?
What does bitwise or mean?
what is difference between equals and ==?
why an outer class cannot be declared as private?
What is the difference between iterator and list iterator?
Why does java have two ways to create child threads?
What are advantages of using Java?s layout managers than windowing systems?
Why doesn't the java library use a randomized version of quicksort?
How do you access command-line arguments within the code?