Plz correct Code given or tell error
Hi all,
I am trying to find solution but no result.
The code is given below. It compile without any error... but when run it, it gives an error
" Object read error ! Writing aborted; java.io.NotSerializableException Class name
Exception in Thread "main" java.lang.NullPointerException "
import java.io.*;
public class MemberMaintainer
{
public static void main(String[] args) throws IOException, ClassNotFoundException
{
Membership membs = null;
try {
FileInputStream fis = new FileInputStream("Membership.data");
ObjectInputStream ois = new ObjectInputStream(fis);
ClubMember.membershipNumber = ois.readInt();
membs = (Membership)ois.readObject();
ois.close();
}
catch(FileNotFoundException e)
{
membs = new Membership(5);
}
catch(Exception e)
{
System.out.println( "Object read error! " + e.getMessage() );
// System.exit( 1 );
}
I hope i will get reply positively
Regards,
Dave

