Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integer[] to a String while setting a text field

 
Chadd Franck
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please supply more details. What happens? What happens when you simply print out the array (System.out.println(allStatsArray2) ?
 
Chadd Franck
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic