title: How to fix "ParseException cannot be resolved to a type"?
body: <p>I have a code which is shown as follows. But it has error, which is indicated as "error line". The error message is:</p>
  
  <blockquote>
    <p>java.lang.NoClassDefFoundError: ParseException.</p>
  </blockquote>
  
  <p>Can anyone help me fix the error? Thank you so much!</p>
  
  <pre><code>import java.util.Calendar;
  import java.util.Date;
  import java.util.GregorianCalendar;
  import java.util.*;
  
  public class TestCalendar2 {
      public static void main(String[] args) throws ParseException{    // error line
          String str = "2020-10-10";
          DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
          System.out.println("df:" + df);
  
          Date date = df.parse(str);
          System.out.println("date:" + date);
  
          Calendar c = new GregorianCalendar();
          System.out.println("c:" + c);
  
          c.setTime(date);    
  
          System.out.println("Sunday\t一\t二\t三\t四\t五\t六");
          c.set(Calendar.DAY_OF_MONTH,1);
  
          for(int i = 0; i &lt; c.get(Calendar.DAY_OF_WEEK)-1;i++) {
              System.out.print("\t");
          }
  
          for (int i=1; i&lt;=c.getActualMaximum(Calendar.DATE); i++) {
              System.out.print(c.get(Calendar.DAY_OF_MONTH)+"\t");
              if(c.get(Calendar.DAY_OF_WEEK)== Calendar.SATURDAY) {
                  System.out.println();
              }
              c.add(Calendar.DAY_OF_MONTH, 1);
          }
      }
  }
  </code></pre>