for each loop to read char from string java code example Example: java foreach char for (char ch: "xyz".toCharArray()) { System.out.println(ch); }