To read a number of type int from an input channel, we use:
Example:
orString s = JOptionPane.showInputDialog("Insert an integer number"); int i = Integer.parseInt(s);
int i = Integer.parseInt( JOptionPane.showInputDialog("Insert an integer number"));
Note that, if parseInt is called on a string containing characters different from digits, an error occurs when the program is run.