import javax.swing.JOptionPane; /** * This program takes user input in the first example and makes prints it out. * The second part takes user input which is returned as a STring and then parses it as an integer value * before the math calculation can be done. Strings cannot have math performed on them so you must parse it * as an int first. I also had to import the JOptionPane above before I could use it. * 2/6/04 * Hunter Lloyd */ public class UserInput { public static void main(String [] args) { String input = JOptionPane.showInputDialog("Give me a few words"); System.out.println(input); String inputInt = JOptionPane.showInputDialog("Give me an int"); int answer = Integer.parseInt(inputInt); answer++; System.out.println(answer); } }