Java tutorial
public class Main { public static void main(String[] args) { String str = "JAVA2S.COM"; // Get the length of string int len = str.length(); // Loop through all characters and print their indexes for (int i = 0; i < len; i++) { System.out.println(str.charAt(i) + " has index " + i); } } }