Preview:
public class String_Builder {
    public static void main(String[] args) {
        StringBuilder s = new StringBuilder("hellooooooo");
        System.out.println(s);

        // Deleting characters from index 0 to 2 (exclusive)
        System.out.println(s.delete(0, 3));

        // Deleting the character at index 5
        System.out.println(s.deleteCharAt(5));

        // Inserting "Raghu" at index 3
        System.out.println(s.insert(3, "Varshith"));

        // Printing the length of the StringBuilder
        System.out.println(s.length());

        // Finding the last index of the string "oo"
        System.out.println(s.lastIndexOf("oo"));
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter