String str = "hello";
for (char c : str.toCharArray())
//process c
String s = "...stuff...";
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
//Process char
}
for(int i = 0, n = s.length() ; i < n ; i++) {
char c = s.charAt(i);
}
String s = "...stuff...";
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
//Process char
}
String s = "Techie Delight";
// convert string to `char[]` array
char[] chars = s.toCharArray();
// iterate over `char[]` array using enhanced for-loop
for (char ch: chars) {
System.out.print(ch);
}