title: JOptionPane Input to int
body: <p>I am trying to make a JOptionPane get an input and assign it to an int but I am getting some problems with the variable types.</p>
  
  <p>I am trying something like this:</p>
  
  <pre><code>Int ans = (Integer) JOptionPane.showInputDialog(frame,
              "Text",
              JOptionPane.INFORMATION_MESSAGE,
              null,
              null,
              "[sample text to help input]");
  </code></pre>
  
  <p>But I am getting: </p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot
  be cast to java.lang.Integer
  </code></pre>
  
  <p>Which sounds logical yet, I cannot think of another way to make this happen.</p>
  
  <p>Thanks in advance</p>