How come the following prints boss and not bass?
String boss = \"boss\"; char[] array = boss.toCharArray(); for(char c : array) { if (c== \'o\') c =
You're assigning 'a' to the local variable c, but not to the array element. To make it print bass, you'd need
for (int i = 0; i < array.length; i++) { if (array[i] == 'o') { array[i] = 'a'; } }