public static boolean dateIsValid(String dateString){
  return dateString.matches(DEFAULT_DATE_REGEX);
}

public static boolean dateIsValid ( String dateString ) { return dateString . matches ( DEFAULT_DATE_REGEX ) ; }
this method checks whether the string indate is a valid date following the format " yyyy - mm - dd " .
