Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



I have 2 objects inside one object(vector). how can i serialize one of them. I dont want to serial..

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

I have 2 objects inside one object(vector). how can i serialize one of them. I dont want to serial..

Answer / saroj kumar biswal

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

I have 2 objects inside one object(vector). how can i serialize one of them. I dont want to serial..

Answer / priya

yes we are able to done the above question by using
transient keyword

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

Hi friends i want display Triangle shap stars(*) please can tell me any one java code logic? * *** ***** ******* Like this

2 Answers   NIIT, TCS,


In a container there are 5 components. I want to display all the component names, how will you do that?

0 Answers  


what is difference between throw and throws in exception?

48 Answers   Spenco,


What is the basic difference between string and stringbuffer object?

0 Answers  


What are the various access specifiers in java?

0 Answers  


What is a type parameter in java?

0 Answers  


What is the is a and has a relation ship in oops concept in java?

9 Answers   BearingPoint, TCS,


Why are there no global variables in java?

0 Answers  


Explain the difference between runnable and callable interface in java?

0 Answers  


What is anagram in java?

0 Answers  


What is treeset in java collection?

0 Answers  


What are the types of java?

0 Answers  


Categories