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

How many ways can you break a singleton class in java?

979


What are thread safe functions?

946


How will you reverse a link list without using recursion?

1031


What is use of a abstract variable?

980


Why is stringbuffer not immutable?

1069


What is anagram word?

993


Can we declare the static variables and methods in an abstract class?

987


What is the difference between Grid and Gridbaglayout?

1234


Which one will take more memory: an int or integer?

1221


What super () does in java?

904


How do you remove duplicates in java?

1007


What does jre stand for?

1056


Is java code slower than native code?

1057


What is synchronization and why is it important in java programming?

936


What are different types of references?

977