Multiple choice technology programming languages

Which modifier tells JVM to avoid object persistence during serialization?

  1. final

  2. transient

  3. public

  4. private

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The transient modifier in Java tells the JVM to skip that field during serialization - it won't be written to the persistent stream. This is useful for fields that can be recalculated, are derived from other data, contain sensitive information, or reference non-serializable objects.