Ernest wrote:
Don't use i=0; i<=1. Use i=0; i<2. The "2" is the size of the array, and once you're used to it, it is completely natural. The first way is confusing because it's not the standard way Java programmers do things.
Absolutely. But in case of beginners it's ok to experiment around.
Just before they start using the
arraysName.length variable. The prefix increment in this for loop is also a bit unusual in my view.
Jeremy, how about this:
And Jeremy wrote:
I'm getting the following compile error...
You just forgot the number/variable in the [ ].
Yours,
Bu.