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 variable c gets changed, but not the array contents. To change the array, don't use c, manipulate the array directly.
c
for(int i = 0; i < array.length; i++) { char c = array[i]; if (c== 'o') array[i] = 'a'; }