title: serialversionUID does not match
body: <p><img src="https://i.stack.imgur.com/mNIb9.png" alt="enter image description here"></p>
  
  <p>I am fairly new to java and I have a class <code>Products</code> that is <code>Serializable</code>. I do not know what I did, but my programs stopped working and gave me this error :</p>
  
  <pre><code>Exception in thread "main" java.io.InvalidClassException: cockeb.Product;
  local class incompatible: stream classdesc serialVersionUID = 1288455942608122525,
  local class serialVersionUID = -558553967080513790
  
  at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
  at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1829)
  at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1986)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
  at java.util.ArrayList.readObject(ArrayList.java:791)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2122)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422
  </code></pre>
  
  <p>I searched around and found ways to declare it, but that doesn't help me right now.  I even went as far as opening a new project and just copying the text in each class from the non working project and pasting it in the new project, but i still get the same error. I am getting this error across all of my projects (they use the same <code>Serializable</code> class) I need to know what i did to do this so it doesn't happen again, and what i can do to fix it.  I already tried to declare the <code>serialversionUID</code> and that did not work.</p>
  
  <p><strong>Product Class</strong></p>
  
  <pre><code>package cockeb;
  
  import java.io.Serializable;
  import java.math.BigDecimal;
  
  public class Product implements Comparable&lt;Product&gt;, Serializable {
  
  private String upc;
  private String shortDetails;
  private String longDetails;
  private BigDecimal price;
  private Integer stock;
  
  public String getUpc() {
      return upc;
  }
  
  public void setUpc(String upc) {
      this.upc = upc;
  }
  
  public String getShortDetails() {
      return shortDetails;
  }
  
  public void setShortDetails(String shortDetails) {
      this.shortDetails = shortDetails;
  }
  
  public String getLongDetails() {
      return longDetails;
  }
  
  public void setLongDetails(String longDetails) {
      this.longDetails = longDetails;
  }
  
  public BigDecimal getPrice() {
      return price;
  }
  
  public void setPrice(BigDecimal price) {
      this.price = price;
  }
  
  public Integer getStock() {
      return stock;
  }
  
  public void setStock(Integer stock) {
      this.stock = stock;
  }
  
  @Override
  public int compareTo(Product t) {
      return this.getUpc().compareTo(t.getUpc());
  }
  }
  </code></pre>