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