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.
I am trying something like this:
This because the input that the user inserts into the JOptionPane is a String and it is stored and returned as a String.
JOptionPane
String
Java cannot convert between strings and number by itself, you have to use specific functions, just use:
int ans = Integer.parseInt(JOptionPane.showInputDialog(...))