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

Answer Posted / lenina

only non static and non transient variables can be serialized.

if we want a variable to be instance variable,but the
variable is non serializable variable, then we declare that
variable as transient. here exactly we can make use of
transient.

Is This Answer Correct ?    26 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about class in java?

608


Which sorting is best in java?

530


What is anti pattern in programming?

497


can I implement my own start() method? : Java thread

548


What are singleton services?

489






Are variables stored in ram?

553


What is a void method?

513


Can we override compareto method?

498


What is the purpose of static methods and variables?

529


Why is the type for real numbers called double?

540


What are different type of exceptions in java?

544


What does %d do in java?

578


What are the concepts of 'OOPS'?

596


How do you sort in descending order in java using collections sort?

492


What is the difference between integer parseint and integer valueof?

544