Ask Question
30 May, 17:06

Explain the usage of the keywordtransient?

+1
Answers (1)
  1. 30 May, 19:49
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers