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
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 |
Answer / puneet
outpurstreamobject.writeobject(object o);
flush//;
close//;
Is This Answer Correct ? | 0 Yes | 2 No |
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What is variable argument in java?
Why do we create threads in java?
Name the packages in JDK?
What is the difference between array and arraylist? what is the difference between arraylist and linkedlist?
Describe string intern() methodology
What is difference between == equals () and compareto () method?
Why parameters should be passed by reference?
Is string a keyword in java?
Explain where variables are created in memory?
What are recursive functions? Give some examples?
0 Answers Axtria, ITC Indian Tobacco Company,
they asked class A{} class B{} class c{} all the three class saved as a single file,there is no main method in the file and anothe class M.java class m { psvm(String args[]) { // here the parent class can access } }
2 Answers DNS, IPSR Solutions,