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[]) {
        StringBuffer buffer = new StringBuffer("hello there");

        System.out.printf("buffer = %s\n", buffer.toString());
        System.out.printf("Character at 0: %s\nCharacter at 4: %s\n\n", buffer.charAt(0), buffer.charAt(4));

        char charArray[] = new char[buffer.length()];
        buffer.getChars(0, buffer.length(), charArray, 0);
        System.out.print("The characters are: ");

    }
}