Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的理解serialVersionUID只适用于类,因为我们只能为类创建对象,而serialVersionUID的概念是用于对象序列化和反序列化。
serialVersionUID
它不是必需的,更重要的是,它不会对序列化在您的应用程序中的工作方式产生任何影响。
由于serialVersionUID应该是静态的,即使你将它添加到你的接口,它也不会被继承,所以你也需要在你的实现类中添加一个。同样,如果扩展了可序列化的基类,则需要serialVersionUID再次添加。