静态static 和瞬态transient关键字

瞬态关键字

transient关键字:瞬态关键字

被transient修饰的成员变量,不能被序列化

如 private transient int age;

static关键字:静态关键字

静态优先于非静态加载到内存中(静态优先于对象进入到内存中)

被static修饰的成员变量同样不能被序列化,序列化的都是对象

原文地址:https://www.cnblogs.com/anke-z/p/12698682.html