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...

why to use transient variables when static variables can be
used for Serialization

Answer Posted / ram

Both static & Transient are may not be serialized.

Static means one per class not one per object. Static
variables are not saved and when an object is deserialized,
it will have whatever static variable its class currently
has. Don’t make serializable objects dependent on a
dynamically-changing static variable. It might not be the
same when the object comes back.

Transient variables are given a value of NULL for object
references and defaults (0, false, etc) for primitives.

Is This Answer Correct ?    12 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are accessor methods in java?

1016


How do I stop concurrentmodificationexception?

1036


What is a void method java?

963


What is the benefit of abstract class?

950


Can static methods be inherited?

1051


What is the protected method modifier?

1049


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

1090


What are memory tables?

1097


How do you avoid global variables?

1095


What is a platform?

1081


What is protected access modifier?

1006


Which list is sorted in java?

1038


What is the difference between the font and fontmetrics classes in java programming?

1159


What is use of valueof () in java?

1054


What are the different types of constructor?

996