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

Why parameters should be passed by reference?

912


Is string pool garbage collected?

949


What is the inheritance?

926


How are observer and observable used in java programming?

965


What is not thread safe?

922


What is difference between checked and unchecked exception in java?

957


Why java is said to be pass-by-value ?

981


What do you mean by stream pipelining in java 8?

1155


State some advantages of java?

1180


What do you know about the garbate collector?

977


Why parsing is done?

917


In a class implementing an interface, can we change the value of any variable defined in the interface?

1023


os is developed in c no java is more secured then c na why dont the os developed is developed using java

4132


What is the purpose of the enableevents() method in java programming?

1081


Why we use methods in java?

939