Forums Register Login

Incompatible types! Into array.

+Pie Number of slices to send: Send
How would I convert string into an object to I can inserted into array?
Thanks
+Pie Number of slices to send: Send
 

Originally posted by g Peshone:
How would I convert string into an object to I can inserted into array?



If you only want the name of the Body to be inserted into the Array you can use a String array instead of your SolBody type Array. Otherwise you could just insert the whole object into your array instead of the name.


[ October 22, 2008: Message edited by: Paul Yule ]
+Pie Number of slices to send: Send
i.e.,

bodies[0] = sun;
+Pie Number of slices to send: Send
Your array is declared to hold references to instances of SolBody, and a String is not a SolBody. It looks to me like you just want to add "sun" to the array, bodies[0] = sun;

(Also, it looks like "nameFor" is already a String, so calling toString() on nameFor isn't necessary.)
+Pie Number of slices to send: Send
Thanks, that works, I thought I could go thru with a generic �field� name but then I could not increment it in the next step to insert next name.
Thanks
We're all out of roofs. But we still have tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1032 times.
Similar Threads
Array assignment
cloning
arraycopy() question
Widening Reference Conversation
how to get it work, sample prog
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:04:38.