String class is immutable so you can only read the characters. You can use charAt(index) method to get individual chars as follows:


for(int i = 0;i < str.length();i++) {
char c =...