// Serializable/externalizable specific import java.io.*; class a implements Serializable { private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { if (stream == null) throw new IOException(); if (stream == null) throw new ClassNotFoundException(); } private void readObjectNoData() throws ObjectStreamException { if (this == null) throw new ObjectStreamException(){}; } private Object readResolve() throws ObjectStreamException { if (this == null) throw new ObjectStreamException(){}; return null; } private Object writeReplace() { return null; } private void writeObject(ObjectOutputStream stream) { if (stream==null) return; } } class b { private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { if (stream == null) throw new IOException(); if (stream == null) throw new ClassNotFoundException(); } private void readObjectNoData() throws ObjectStreamException { if (this == null) throw new ObjectStreamException(){}; } private Object readResolve() throws ObjectStreamException { if (this == null) throw new ObjectStreamException(){}; return null; } private Object writeReplace() { return null; } private void writeObject(ObjectOutputStream stream) { if (stream==null) return; } } //////////////////////////// abstract class abstractNoSerializable { protected Object readResolve() throws ObjectStreamException { return null; } } class serializableSubclassOfAbstractNoSerializable extends abstractNoSerializable implements Serializable { public static void main(String[] args) { System.out.println(new serializableSubclassOfAbstractNoSerializable().toString()); } static { new a(); new b(); } static final long serialVersionUID = 20130808044800000L; }