@Override public void writeExternal(ObjectOutput out) throws IOException {
  out.writeInt(id);
}

@ Override public void writeExternal ( ObjectOutput out ) throws IOException { out . writeInt ( id ) ; }
the object implements the writeexternal method to save its contents by calling the methods of dataoutput for its primitive values or calling the writeobject method of objectoutput for objects , strings , and arrays .
