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.
Reputation Points: 1658
Solved Threads: 331
duckman
Offline 7,719 posts
since Nov 2004