This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hey all, I am trying to get a variable to concatinate to a string then use that string as a command like this: newx = place + "[" + num + "]"; Where place = "ones" and num = "8".
So my line new line is: newx = ones; This will make newx equal to the static string array "ones" in the "8" place. I can get the concatination to the string but it doesn't treat the string like a command. Thanks for the help! Don
Yes, all you did was assign the String value "ones" to newx. You cannot use a String Object to represent a variable. If you want to assign the value in ones to newx you have to use the variable name. If num is a String you'll have to convert it to an int first.
If places can hold other values besides "ones" you need to put this in a controll structure to determine which array to place it in.