0

Why do we use serialversionuid in java when serializing the object? and what is the benefit of it?

package testDemo;

import java.io.Serializable;

public class SerialTest implements Serializable
    private static final long serialVersionUID = -4180381409376176730L;
    public static void main(String[] args) {

    }
}
user207421
  • 305,947
  • 44
  • 307
  • 483
  • possible duplicate http://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it – xxlali Apr 20 '15 at 10:23
  • You've ostensibly asked two questions here, but they are really both the same, unless you're implying that the reasons for doing something are distinct from the benefits. As a matter of fact we don't use serialVersionUID when serializing the object, but when writing the class. – user207421 Apr 20 '15 at 10:40

0 Answers0