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) {
        boolean b = true;
        StringBuffer sb1 = new StringBuffer("1234567890");
        sb1.insert(6, b);
        System.out.println(sb1);

        char c = 'Y';
        sb1.insert(6, c);
        System.out.println(sb1);

        char[] c1 = new char[] { 'Y', 'e', 's' };
        sb1.insert(6, c1);
        System.out.println(sb1);

        double d = 1.0;
        sb1.insert(6, d);
        System.out.println(sb1);

        float f = 2.0f;
        sb1.insert(6, f);
        System.out.println(sb1);

        int i = 5;
        sb1.insert(6, i);
        System.out.println(sb1);

        long l = 10;
        sb1.insert(6, l);
        System.out.println(sb1);

        Object obj = new String("b");
        sb1.insert(6, obj);
        System.out.println(sb1);

        String str = "a";
        sb1.insert(6, str);
        System.out.println(sb1);
    }
}
/*
123456true7890
123456Ytrue7890
123456YesYtrue7890
1234561.0YesYtrue7890
1234562.01.0YesYtrue7890
12345652.01.0YesYtrue7890
1234561052.01.0YesYtrue7890
123456b1052.01.0YesYtrue7890
123456ab1052.01.0YesYtrue7890
*/