title: Date/month validation
body: <p>here is a description on what I'm trying to do: </p>
  
  <blockquote>
    <p>First, the program will print "Enter month>," and then the user must
    enter a number. If the entered number is not in the range of 1 to 12
    as the following error message is printed "Improper month.", And the
    program then ends. If the entered month is correct, the program will
    print "Enter the day of month>," and then the user must enter a
    to-speech. If the number does not correspond to a day in the previous
    input the month, the following error message is printed "Wrong day of
    the month.", And the program then ends. If both the input month number
    and the entered day of the month is correct, then the program should
    print "The correct date.", And then terminated.</p>
  </blockquote>
  
  <p>But I get this error below and I can't figure out why</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\ ][decimal separator=\,][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Q?\E][infinity string=\Q∞\E]"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  at java.lang.Integer.parseInt(Integer.java:449)
  at java.lang.Integer.parseInt(Integer.java:499)
  at upp.main(upp.java:10)
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>import java.util.Scanner;
  public class upp {
  public static void main(String[] args) {
  
      int[] numberOfDaysEachMonth = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
      System.out.println("Enter month &gt; ");
      Scanner month = new Scanner(System.in);
      int userInputMonth = Integer.parseInt(month.toString());
      if (userInputMonth &gt; 0 &amp;&amp; userInputMonth &lt; 13) {
          System.out.println("Enter the day of month &gt; ");
          Scanner day = new Scanner(System.in);
          int userInputDay = Integer.parseInt(day.toString());
          if (userInputDay &gt; 0 &amp;&amp; userInputDay &lt; numberOfDaysEachMonth[userInputMonth - 1]) {
              System.out.println("Correct date.");
          } else {
              System.out.println("Wrong date.");
          }
      } else {
          System.out.println("Wrong month.");
      }
  }
  }
  </code></pre>