import javax.swing.*; class Array2 { public static void main(String[] args) { String xStr,outStr; StringBuffer outputStringBuff; int i,n=0; String[] x; boolean okay = false; while (!okay) { xStr = JOptionPane.showInputDialog(null,"Enter the number of words you want to see"); try { n = Integer.parseInt(xStr); okay = true; } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null,"This is not an integer, please re-enter"); } } x = new String[n]; for (i=0;i