Code example for NotSerializableException

public class MonitorState extends AbstractSingleWrapperState implements AvoidanceReportingState { 
  /* Boilerplate code to avoid serializing this class */ 
  private static final long serialVersionUID = 0xDEADBEEF;
  private void writeObject( out) throws IOException {
    throw new NotSerializableException();
  static enum TimeoutState implements AbstractState { 
    public String toString() {
      return "Dummy element because computation timed out"; 
  private final long totalTimeOnPath;
  // stores what caused the element to go further (may be null)