title: Display an error message for the non-numeric input
body: <p>So this is my code i dont know what to add if i want to display invalid message for the non numeric inputs please help ty</p>
  
  <pre><code>import java.util.Scanner;
  public class Date
  {
  public static void main (String args [])
  {
      int x;
  Scanner in = new Scanner (System.in);
  System.out.print("Enter a date ");
  x = in.nextInt();
  
  
  while (x &lt; 1520 || x &gt; 3999)
  {
  System.out.println ("Invalid Gregorian Calendar date.");
  System.out.print ("Please Input a valid Gregorian Calendar date: ");
  x = in.nextInt();
  }
  System.out.println("Good");
  </code></pre>