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.
i just ran in to a situation where i am converting a string to a number and then inserting the number in to an array. i thought this code sample might be helpful for newbies - i sure learned something.
anything pre/post increment/decrement on the line before the exception is thrown is on the stack and will be executed (k++,++n1), but anything after the exception is not (++n2). also try n1++, etc, just for fun. hope this helps someone avoid logic errors :-)
use the [CODE] tags - it makes it much easier for people to help you.
Of course, simply not trying to do too many things at once and on a single line would greatly improve the readability of the code as well as reduce the likelihood of any logic errors. So, rather than trying to do something like, array[ i++ ] = ++j ; just break it apart and say what you mean, one thing at a time ++j ; array[ i ] = j ; ++i ;