Answer:
for (int i=0; i<passCode.length(); i++) {
if ((passCode.charAt(i) >= 65 && passCode.charAt(i) <= 90) || (passCode.charAt(i) >= 97 && passCode.charAt(i) <= 122)) {
System.out.println("Alphabetic at " + i);
}
}
Explanation:
The rest of the code should be as above.
In order to check if the character is alphabetic or not, we need to use ASCII table. Characters are represented as integers in the ASCII table. For example "a" equals 97, "A" equals 65.
Then all we need to is to check if the character value in ASCII is in alphabetic ranges. If it is, print the index of the character.