-4

I am trying to serialise instances of class Employee. But I see an exception happening and I cant figure out why Any help would be much appreciated Thanks in advance!!! :-)

My code can be found at this link, sorry I couldnt figure out what Stack Overflow was saying me an an error

Find my program at GitHub here

I've imported necessary files too.... The stack trace is

Exception in thread "main" java.io.NotSerializableException: ex5_2.Employee
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at ex5_2.Ex5_2.main(Ex5_2.java:130)

1 Answers1

2

In order to serialize objects you need that the class to serialize implements Serializable.

for example: class Order implements Serializable

Ricard Nàcher Roig
  • 1,271
  • 12
  • 14