Edit: solved
I am trying to use a for loop with the for(type *:*) syntax. I started in C++ so have never used this syntax. I am attempting to change some values inside this array but the values do not seem to be staying after exiting the loop.
for(char eachChar : msgArr) { System.out.println(eachChar); eachChar = (char) (eachChar + 1); System.out.println(eachChar); } System.out.println(msgArr);
If message array starts as "test" the output will be:
t u e f s t t u test
The expected output should be uftu at the last line, but instead continues to say test! Am I missing something silly or am I misunderstanding this for loop syntax.
I appreciate any assistance!
--- Update ---
Ok eachChar is local variable to the for loop! I used a vanilla loop and that worked.