Results 1 to 5 of 5
- 03-20-2010, 03:55 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 9
- Rep Power
- 0
How can I get my array output result onto one dialog box???
I'm having a huge problem trying to get my entire array output into a single Dialog Box instead of having one for every integer and string.
I'm mainly trying to get my output below here:Java Code:import java.util.*; import javax.swing.JOptionPane; public class Homework7 { public static void main(String []args) { String s; int numTests; s = JOptionPane.showInputDialog(null, "How many test grades have you given?"); numTests = Integer.parseInt(s); JOptionPane.showMessageDialog(null, "The number of tests given is: " + numTests); int [] myGrades = new int [numTests]; for (int i=0; i<=myGrades.length; i++) { String gradeIndex = "The grade at index " + i + " is " + myGrades[i]; JOptionPane.showMessageDialog(null, gradeIndex); } } // end of main method
The grade at index 0 is 0
The grade at index 1 is 0
The grade at index 2 is 0
The grade at index 3 is 0
The grade at index 4 is 0
etc......
All onto 1 Dialog Box, instead of 1 box for each printed line.
Also please elaborate on your suggestions as I am still very new to JAVA.
-
Hello.
Please read what JavaRanch says about cross-posting without being forthright about it: BeForthrightWhenCrossPostingToOtherSites
The same etiquette applies here and in the other programming fora.
I will list one cross-post: http://forums.sun.com/thread.jspa?th...55251#10955251
Are there any others?
Thanks in advance for your cooperation and best of luck.
- 03-20-2010, 04:03 AM #3
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,143
- Rep Power
- 5
Not only that, I gave you the answer yesterday when you asked the same question:
How to display array integer in JOptionPane message dialog ?
- 03-20-2010, 04:07 AM #4
Member
- Join Date
- Mar 2010
- Posts
- 9
- Rep Power
- 0
No thats the only one, sorry for the inconvenience. I'm still very new to posting for help on forums.
-
Well, for one, you may wish to reply to the reply to you in the other forum, and also while you're there, mention that you have cross-posted here. Obviously there's no need to mention that here since we've already done that. Luck.
Similar Threads
-
How to display array integer in JOptionPane message dialog ?
By Reero8532 in forum New To JavaReplies: 13Last Post: 03-20-2010, 01:03 AM -
Printing multiple array elements using only one dialog box using a for loop
By soccer_kid_6 in forum New To JavaReplies: 0Last Post: 03-10-2010, 02:13 AM -
Help with Array output Needed!
By 2potatocakes in forum New To JavaReplies: 2Last Post: 03-07-2009, 06:36 PM -
output from an array
By @eddie.com in forum New To JavaReplies: 5Last Post: 08-15-2008, 08:26 AM -
Simply output the result to a text file.
By silvia in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks