This sample program will show the use of SampleDateFormat for validating the date for a particular format.

Java Code:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ValidationExp {

	public static void main(String[] args) {
		String pattern = "dd/MM/yy";
		SimpleDateFormat sdf = new SimpleDateFormat();
		String strDate = "29/07/06";
		try {
			sdf.applyPattern(pattern);
			Date date =sdf.parse(strDate);
			System.out.println("Date :- " + date);
		} catch (ParseException e) {
			System.out.println("Wrong date format");
			e.printStackTrace();
		}
	}

}