This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Integer[] to a String while setting a text field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Integer[] to a String while setting a text field" Watch "Integer[] to a String while setting a text field" New topic
Author

Integer[] to a String while setting a text field

Chadd Franck
Ranch Hand

Joined: Nov 05, 2008
Posts: 50
Could someone tell me what is wrong?

assuming allStatsArray2 is an Integer[].

I keep getting null values I think.

I did a workaround like this

and it works what am I missing?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38467
    
  23
Please supply more details. What happens? What happens when you simply print out the array (System.out.println(allStatsArray2) ?
Chadd Franck
Ranch Hand

Joined: Nov 05, 2008
Posts: 50
Well, unfortunately I changed all the code before I posted so I will have to take some time to rewrite a sampleClass to post. I just read the faq on how to post, will will give some more effort before I repost.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19675
    
  18

Originally posted by Chadd Franck:
Could someone tell me what is wrong?

assuming allStatsArray2 is an Integer[].

Have you also initialized each element of the array? "new Integer[X]" creates a new array object alright, but all of its elements remain null (or false for boolean, 0 for numbers, \u0000 for char). You need to initialize each one separately.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integer[] to a String while setting a text field