that is likely not what was intended, as it shows a separate messagebox for each element of the array :)
better would be something like
StringBuilder builder = new StringBuilder(p.length);
for (int i=0;i<p.length;builder.append(p[i++])) builder.append("\n");
JOptionPane.showMessageDialog(null, builder.toString(), "Printing results", JOptionPane.INFORMATION_MESSAGE);
this will put each element of the array onto its own line.
When using Java versions lower than 1.5 use StringBuffer instead of StringBuilder.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337