Why doesn't assigning to the iteration variable in a foreach loop change the underlying data?
Asked 2013-04-05T22:09:33.570
65
How come the following prints boss and not bass?
String boss = "boss";
char[] array = boss.toCharArray();
for(char c : array)
{
if (c== 'o')
c = 'a';
}
System.out.println(new String(array)); //How come this does NOT print out bass?It prints boss.