请先看两段代码 package com.jadyer.base; public class User implements java.io.Serializable{ private static final long serialVersionUID = 2035637204889097968L; private Integer age; public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } }
package com.jadyer.base; import java.io.Serializable; public class User implements Serializable{ private static final long serialVersionUID = 2035637204889097968L; private Integer age; public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } }
同样是实现序列化接口,那么这两种书写方式将导致JVM在底层处理上有何差异呢......