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 restrictions are placed on method overriding in java programming?

1055


describe synchronization in respect to multithreading? : Java thread

977


What are the files generated after using IDL to java compiler?

1211


What is nested interface?

1051


What is private protected in java?

1098


Why are parameters used in functions?

1078


Can I override protected method in java?

1131


What is the size of boolean variable?

1135


Can you have two constructors in java?

1047


Can constructor be protected in java?

1021


Where will it be used?

1993


Which list does not allow duplicates in java?

996


What are the uses of java?

1140


Tell me how many ways are there to initialise an integer with a constant.

1155


What does compareto () do in java?

1059