title: Java - Date constructor accepts a Date String, But deprecated. Tried alternatives, but no luck
body: <pre><code>String temp_date="07/28/2011 11:06:37 AM";  
  Date date = new Date(temp_date); //Depricated 
  SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy hh:mm:ss"); 
  String comp_date= sdf.format(date);
  System.out.println(comp_date);
  </code></pre>
  
  <p>This works, But If I use something like this</p>
  
  <pre><code>String temp_date="07/28/2011 11:06:37 AM";  
  try{  
      SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy hh:mm:ss"); 
      Date comp_date= sdf.parse(temp_date);
      System.out.println(comp_date);
  }catch(Exception e){
      System.out.println(e);
  }
  </code></pre>
  
  <p>This exception is thrown:</p>
  
  <pre><code>java.text.ParseException: Unparseable date: "07/28/2011 11:06:37 AM"
  </code></pre>