I have 2 objects inside one object(vector). how can i
serialize one of them. I dont want to serialize the second one
Answers were Sorted based on User's Feedback
Answer / 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 |
this answer is not correct. bcz java compiler will throw an error-illegal declaration of statement.check it out.
I think we will go for Externalizable interface. But the problem is how write the code inside writeExternal() & readExternal() methods
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / priya
yes we are able to done the above question by using
transient keyword
| Is This Answer Correct ? | 0 Yes | 2 No |
What lambda means?
explain the life cycle of thread?
10 Answers CTS, NIIT, TCS,
What is the program development process?
Which of the following can be referenced by a variable? A. The instance variables of a class only B. The methods of a class only C. The instance variables and methods of a class
What is singleton math?
What is namespace in java?
what is the use of thread?Justify it by project point of view
What is the superclass of exception?
What is 16 bits called?
What is floor math?
Why 1 is not a prime number?
Can you override a private or static method in java?