Ask Question
27 May, 21:55

Explain the usage of the keywordtransient?

+4
Answers (1)
  1. 28 May, 01:36
    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?
Get an answer to your question ✅ “Explain the usage of the keywordtransient? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers