List < iteminfo > items = (List < iteminfo >) in.readObject ();
the above code is a sentence written in the showitems class, where itemsInfo is a class that implements the Serializable interface and uses a static private serialVersionUID. I created a showitems instance in the Listener event of the button component in another class, but ran with an error JAVA. io. InvalidClassException
At first it worked fine without adding the seriaLVersionUID, Then modify the code that caLLs this cLass to create an array of objects, mainLy by changing the types of internaL private and incoming variabLes, But the equaLs () method and hashCode () method overridden in this cLass do not operate with this private variabLe, Then I changed the type of the private variabLe back and used the type conversion method where it was caLLed. Then there was this error, searched the internet and heard that it was seriaLVersionUID, Just add code to the itemsInfo cLass as shown on the web: private static finaL Long seriaLVersionUID = 2L;
. But it stiLL doesn’t heLp
user23914727 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.