Code example for ObjectOutputStream

Methods: putFields, writeFields

0
                                    new SimpleClass(1965, "Hello Jupiter")); 
        shortValue = getField.get("shortValue", (short) 4321);
    } 
     
    private void writeObject(ObjectOutputStream oos) throws IOException {
        putField = oos.putFields();
        // Do not put anything into putField so that the get methods 
        // will have to use default values. 
        oos.writeFields();
    } 
     
}