title: JOptionPane and reading integers - Beginner Java
body: <p>I currently have code that reads the month, date, and year a user enters in one line (separated by spaces). Here is the code.</p>
  
  <pre><code>Scanner input = new Scanner(System.in);
  int day = 0;
  int month = 0;
  int year = 0;
  
  System.out.printf("enter the month, date, and year(a 2 numbered year). Put a space between the month, day, and year");
  month = input.nextInt();
  day = input.nextInt();
  year = input.nextInt();
  </code></pre>
  
  <p>This works fine, the second part is to display a message, if month * day == year, then it is a magical number, if not, then it is not a magical number. It has to be displayed in a dialog box. here is my code for that, and it is working just fine. </p>
  
  <pre><code>  if((day * month) == year)
    {
      String message = String.format("%s", "The date you entered is MAGIC!");//If the day * month equals the year, then it is a magic number
      JOptionPane.showMessageDialog(null, message);
    }
    if((day * month) != year)
    {  
      String message = String.format("%s", "The date you entered is NOT MAGIC!");//If the day * month does not equal the year, it is not a magic number
      JOptionPane.showMessageDialog(null, message);
    }
  </code></pre>
  
  <p>My question is!! How can I get a dialog box to take the inputs of the month, date, and year in one line the way it works in the console. I'm working in DrJava, and the chapter of the book I'm in doesn't help me with this specific use. Any help would be great. Thanks all!</p>