title: Cast string to date Java
body: <p>Any ideas why this isnt working?</p>
  
  <pre><code>DateFormat df = new SimpleDateFormat("dd/mm/yyyy");
      Date date1 = null, date2 = null;
      String start, finish;
      System.out.println("Please enter a start date:");
      while(date1 == null){
          try{
              start = scan.next();
              date1 = (Date) df.parse(start);
          }catch(ParseException e){
              System.out.println("Please enter a valid date!");
          }
      }
  </code></pre>
  
  <p>Im getting a classCastException</p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
  </code></pre>
  
  <p>I can't see the problem?</p>