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 state does a thread enter when it terminates its processing? : Java thread
Why hashset is used in java?
What is the implementation of destroy method in java. Is it native or java code?
What are the advantages of user defined functions?
Explain how to convert any java object into byte array.
What function extracts specified characters from a string?
What are library required to connect to excel sheet.
Explain 5 io best practices?
my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??
What is difference between hashset and hashmap in java?
Which method cannot be overridden in java?
Explain numeric promotion?