Ask Question

Explain the usage of the keywordtransient?

+2
Answers (1)
  1. 27 June, 04:13
    0
    'transient' is a java language keyword used to mark fields which should not be included in object serialization.

    Explanation:

    When an object is serialized, that is, when the object is persisted in the file system, some of the fields may not be relevant for storage and restoration. An example might be a connection object to a database which might become stale by the time when the object is deserialized. Such fields can be marked as 'transient' to ensure that they are not part of the serialization mechanism for the object. Usage is as follows:

    transient;

    e. g.,

    class Demo{

    String name;

    int age;

    transient int income;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Explain the usage of the keywordtransient? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers