68 774
Assignments Done
Successfully Done
In January 2019

Answer to Question #63007 in Java | JSP | JSF for jonney

Question #63007
what is meant by giving a variable within a class variable a transient attribute?
Expert's answer
transient is a Java keyword which marks a member variable not to be serialized when it is persisted to streams of bytes. When an object is transferred through the network, or saved on a hard drive the object needs to be 'serialized'. Serialization converts the object state to serial bytes. Those bytes are sent over the network and the object is recreated from those bytes. Member variables marked by the java transient keyword are not transferred; they are lost intentionally.

In an object you may have information that you don't want to serialize (a stored password or any private information), or perhaps it doesn't make sense to serialize (a reference to a parent factory object). Marking these as 'transient' means the serialization mechanism will ignore these fields.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions