Iterating the Characters of a String
import java.text.CharacterIterator; import java.text.StringCharacterIterator; public class Main { public static void main(String[] argv) throws Exception { CharacterIterator it = new StringCharacterIterator("abcd"); // Iterate over the characters in the forward direction for (char ch = it.first(); ch != CharacterIterator.DONE; ch = it.next()) { System.out.println(ch); } } }