Not serializable class with strings only <p>I have a class called Libro which contains strings only:</p> <pre><code>public class Libro { private String titolo; private String autore; private String editore; private String sottotitolo; private String genere; private String dpubb; private String lpubb; private String soggetto; private String isbn; private String note; private String prezzo; private String npag; //getters, setters, constructors... } </code></pre> <p>Then I created an object called <code>a</code> belonging to the <code>Libro</code> class, and I tried to write it to a <code>coso.dat</code> file</p> <pre><code>try{ ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("C:\\Users\\Workbench\\Documents\\NetBeansProjects\\coso.dat")); out.writeObject(a); out.close(); }catch(Exception e) {System.out.println("Damn");} </code></pre> <p>Then I opened the file with NotePad and it seems that I tried to serialize an unserializable class: </p> <pre><code>¬í {sr java.io.NotSerializableException(Vx ç†5 xr java.io.ObjectStreamExceptiondÃäk9ûß xr java.io.IOExceptionl€sde%ð« xr java.lang.ExceptionÐý&gt;;Ä xr java.lang.ThrowableÕÆ5'9w¸Ë L causet Ljava/lang/Throwable;L detailMessaget Ljava/lang/String;[ stackTracet [Ljava/lang/StackTraceElement;L suppressedExceptionst Ljava/util/List;xpq ~ t ginobook.classi.Librour [Ljava.lang.StackTraceElement;F*&lt;&lt;ý"9 xp )sr java.lang.StackTraceElementa Åš&amp;6Ý… I lineNumberL declaringClassq ~ L fileNameq ~ L methodNameq ~ xp t java.io.ObjectOutputStreamt ObjectOutputStream.javat writeObject0sq ~ \q ~ q ~ t writeObjectsq ~ ôt ginobook.forms.FormNuovot FormNuovo.javat btnCreaActionPerformedsq ~ q ~ q ~ t access$1500sq ~ Œt ginobook.forms.FormNuovo$15q ~ t actionPerformedsq ~ æt javax.swing.AbstractButtont AbstractButton.javat fireActionPerformedsq ~ ,t "javax.swing.AbstractButton$Handlerq ~ q ~ sq ~ ’t javax.swing.DefaultButtonModelt DefaultButtonModel.javaq ~ sq ~ q ~ $q ~ %t setPressedsq ~ üt *javax.swing.plaf.basic.BasicButtonListenert BasicButtonListener.javat mouseReleasedsq ~ …t java.awt.Componentt Component.javat processMouseEventsq ~ üt javax.swing.JComponentt JComponent.javaq ~ /sq ~ šq ~ -q ~ .t processEventsq ~ ¼t java.awt.Containert Container.javaq ~ 4sq ~ q ~ -q ~ .t dispatchEventImplsq ~ öq ~ 6q ~ 7q ~ 9sq ~ gq ~ -q ~ .t dispatchEventsq ~ t java.awt.LightweightDispatcherq ~ 7t retargetMouseEventsq ~ ­q ~ &gt;q ~ 7q ~ /sq ~ rq ~ &gt;q ~ 7q ~ &lt;sq ~ èq ~ 6q ~ 7q ~ 9sq ~ ºt java.awt.Windowt Window.javaq ~ 9sq ~ gq ~ -q ~ .q ~ &lt;sq ~ öt java.awt.EventQueuet EventQueue.javaq ~ 9sq ~ aq ~ Hq ~ It access$500sq ~ Åt java.awt.EventQueue$3q ~ It runsq ~ ¿q ~ Mq ~ Iq ~ Nsq ~ ÿÿÿþt java.security.AccessControllert AccessController.javat doPrivilegedsq ~ Lt 5java.security.ProtectionDomain$JavaSecurityAccessImplt ProtectionDomain.javat doIntersectionPrivilegesq ~ Vq ~ Uq ~ Vq ~ Wsq ~ Ût java.awt.EventQueue$4q ~ Iq ~ Nsq ~ Ùq ~ Zq ~ Iq ~ Nsq ~ ÿÿÿþq ~ Qq ~ Rq ~ Ssq ~ Lq ~ Uq ~ Vq ~ Wsq ~ Øq ~ Hq ~ Iq ~ &lt;sq ~ Ét java.awt.EventDispatchThreadt EventDispatchThread.javat pumpOneEventForFilterssq ~ tq ~ `q ~ at pumpEventsForFiltersq ~ iq ~ `q ~ at pumpEventsForHierarchysq ~ eq ~ `q ~ at pumpEventssq ~ ]q ~ `q ~ aq ~ hsq ~ Rq ~ `q ~ aq ~ Nsr &amp;java.util.Collections$UnmodifiableListü%1µìŽ L listq ~ xr ,java.util.Collections$UnmodifiableCollectionB €Ë^÷ L ct Ljava/util/Collection;xpsr java.util.ArrayListxÒ™Ça I sizexp w xq ~ px </code></pre> <p>What did I do wrong..? I'm sorry if the question may seem stupid, but I just couldn't find any answer to it</p>