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
Explain jvm, jre, and jdk?
What is the difference between private & public & friendly classes?
Is java a pure object oriented language?
How do you sort objects in java?
What does system.gc() and runtime.gc() methods do?
What is difference between == equals () and compareto () method?
What is native method in java?
Why we cannot override static method?
What is supplier in java?
What is a local, member and a class variable?
What is the difference between an interface and an abstract class?
What is an infinite loop?
What will happen if static modifier is removed from the signature of the main method?
What are static variables and functions?
Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?