Results 21 to 27 of 27
Thread: arrayList with numbers in it.
- 08-28-2011, 06:06 PM #21
The problem is the output of the
Every time that one is printed now I get the same value.Java Code:child2.setAttribute("calc_neutral_pep_mass", massaInfo);
But what I calculated (sum1) is what I need to be printed behind the calc_neutral_pep_mass.
So I exported sum1 out of the loop to the child2.setAttribute....
Every time the program runs the while loop the value is a diffrent one, because every time the sum1 is calculated again for a new set of values.
- 08-28-2011, 06:08 PM #22
If you don't change anything it SHOULD ALWAYS get the same value.Every time that one is printed now I get the same value.
- 08-28-2011, 06:08 PM #23
How do you meen?
The sum1 that is stored in the arrayList is every time diffrent.
And then I take out the last one stored, and let that one print behind the child.setAttribute.....Last edited by Lund01; 08-28-2011 at 06:12 PM.
- 08-28-2011, 06:20 PM #24
For example:
Java Code:int x = 1234; for (int i=0; i < 10; i++) { System.out.print("x=" + x); // print value of x (will always be the same) } // end for(i)
- 08-28-2011, 06:31 PM #25
Any idea on what line of code I then need to add on that part you explained above?
- 08-28-2011, 06:37 PM #26
No I have no idea. If a variable is not changing in value and you think it should be changing, you need to back track through your code to see why it is not changing. An interactive debugger is useful for doing that. Otherwise add lots of println statements to your code to track how variables are changing.
- 08-28-2011, 09:13 PM #27
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
I found the solution for your problem regarding ArrayList. It was in a forum, may be that helps youUse of Collection Class in JAVA-- ArrayList
Similar Threads
-
ArrayList copy some of the element from one arraylist tnto another arraylist
By ralf in forum New To JavaReplies: 12Last Post: 07-07-2011, 08:49 PM -
Problem getting numbers from user and finding smallest two numbers
By radhi16 in forum New To JavaReplies: 11Last Post: 01-14-2011, 06:36 PM -
how to add Arraylist filter for a jsp page showing results from a servlet-Arraylist
By alok_sharma in forum Java ServletReplies: 7Last Post: 11-22-2010, 01:26 PM -
printing two smallest numbers from a series of numbers
By trofyscarz in forum New To JavaReplies: 2Last Post: 10-14-2008, 11:46 PM -
Java Project Trouble: Searching one ArrayList with another ArrayList
By BC2210 in forum New To JavaReplies: 2Last Post: 04-21-2008, 11:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks