Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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);
        }

    }
}