I have 2 objects inside one object(vector). how can i
serialize one of them. I dont want to serialize the second one
Answer Posted / atre sachin
suppose we are storing the two object of class A in Vector v1
class A implements serialiazable{
....
}
A a1=new A() //this will be the persist
transient A a2 =new A() //this will not persist because of the transient keyword.
now if I store the both a1 and a2 object in the vector v1 then we can achieve the goal given.
:-)
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
Can substring create new object?
Explain the difference between arraylist and linkedlist in java?
What is the effect of keeping a constructor private?
Is hashmap thread safe?
What is math in java?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread
Mention some interfaces implemented by linked list in java.
What is finally and finalize in java?
What is instance synchronization?
Does every java program need a main?
What is class and its types?
What is return type in java?
Does java linked list allow duplicates?
Is stringwriter thread safe?
Why lambda expression is used in java?