为什么在非序列化类中声明瞬态变量是合法的? [英] Why is it legal to declare a transient variable in a non serializable class?
本文介绍了为什么在非序列化类中声明瞬态变量是合法的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于主题标题:为什么在非序列化类中声明瞬态变量是合法的?
有什么用?
As for the subject title: Why is it legal to declare a transient variable in a non serializable class? What would the use be?
推荐答案
transient
访问修饰符可以通过除以外的代码看到序列化机制,并被一些对象数据库用于将数据字段标记为不持久。除此之外,允许这样做没有任何伤害。
The transient
access modifier can be seen by code other than the serialization mechanism, and is used by some object databases to mark a data field as not persistent. Aside from that, there isn't any harm in allowing this.
这篇关于为什么在非序列化类中声明瞬态变量是合法的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文