MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

public class MainClass {
    public static void main(String args[]) {
        String letters = "abcdefghijklmabcdefghijklm";

        System.out.printf("'c' is located at index %d\n", letters.indexOf('c'));
        System.out.printf("'a' is located at index %d\n", letters.indexOf('a', 1));
        System.out.printf("'$' is located at index %d\n\n", letters.indexOf('$'));

    }
}