fork download
  1. // package test;
  2.  
  3. import java.io.ByteArrayOutputStream;
  4. import java.io.ObjectOutputStream;
  5. import java.io.ObjectStreamField;
  6. import java.io.Serializable;
  7.  
  8.  
  9. class mySerializable implements Serializable {
  10.  
  11. private int f;
  12. private int g;
  13.  
  14. private static final ObjectStreamField[] serialPersistentFields = {
  15. new ObjectStreamField("f", int.class),
  16. new ObjectStreamField("g", int.class),
  17. };
  18.  
  19. public static void main(String[] args) {
  20.  
  21. save();
  22.  
  23. }
  24. public static void save() {
  25. try {
  26. out.writeObject(new mySerializable());
  27. out.close();
  28. fileOut.close();
  29. } catch (Exception ex) {
  30. System.out.println("save()" + ex.getLocalizedMessage()); }
  31. }
  32. }
Success #stdin #stdout 0.07s 4386816KB
stdin
Standard input is empty
stdout
save()mySerializable; unmatched serializable field(s) declared