Multiply the integers in input.
String s; // current input string int n; // current integer int product; // variable used as accumulator product = 1; // 1 is the neutral element for multiplication s = JOptionPane.showInputDialog("Input an integer"); while (s != null) { n = Integer.parseInt(s); product = product * n; s = JOptionPane.showInputDialog("Input an integer"); } System.out.println("product = " + product);