22.9. Banking Example: Class SimpleDate

public class SimpleDate extends Date {
    private static final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
    
    public SimpleDate(String datestr) throws Exception {             
        setTime(format.parse(datestr).getTime());
    }
}
  • The convenience class SimpleDate extends java.util.Date, providing a constructor taking a String as input and defining a date format.