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 |
How does serialization work
WHAT IS THE MEANING OF ALL TYPE OF BUZZWORDS?
Can we have multiple classes in a single file?
33. try { 34. // some code here 35. } catch (NullPointerException e1) { 36. System.out.print(”a”); 37. } catch (RuntimeException e2) { 38. System.out.print(”b”); 39. } finally { 40. System.out.print(”c”); 41. } What is the result if a NullPointerException occurs on line 34? 1 c 2 a 3 ab 4 ac
Why Java is called as purely platform independent..? Explain briefly..dont Give regular answers Explain with your own example..?
What is meant by class?
What are autoboxing and unboxing? When does it occur?
How many bytes is a url?
What is the protocol is used in type4 driver?
How to call static method?
What is string made of?
What are the types of relation?