Example usage for java.lang StringBuffer StringBuffer

List of usage examples for java.lang StringBuffer StringBuffer

Introduction

In this page you can find the example usage for java.lang StringBuffer StringBuffer.

Prototype

@HotSpotIntrinsicCandidate
public StringBuffer() 

Source Link

Document

Constructs a string buffer with no characters in it and an initial capacity of 16 characters.

Usage

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    boolean booleanValue = true;
    buffer.insert(0, booleanValue);//from  w  w  w. j a  v a 2  s .c o m

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    double doubleValue = 33.3;
    buffer.insert(0, doubleValue);/*  w  w  w  .  j  av  a  2s  . co m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    int integerValue = 7;
    buffer.insert(0, integerValue);//  w  w w .  ja va2s .c  o  m

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    char characterValue = 'K';
    buffer.insert(0, characterValue);//  w ww .ja  va2  s  .  c  om

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    long longValue = 10000000;
    buffer.insert(0, longValue);/*w  w  w  . j av a 2s .c o m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    String string = "java2s.com";
    buffer.insert(0, string);/*ww  w  . j  ava2  s.c  o m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    float floatValue = 2.5f;
    buffer.insert(0, floatValue);//from   www  .  ja v a2  s  .co m

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    char charArray[] = { 'a', 'b', 'c', 'd', 'e', 'f' };
    buffer.insert(0, charArray, 3, 3);/*  w  w  w. j av a2  s. co m*/

    System.out.println(buffer.toString());

}

From source file:MainClass.java

public static void main(String[] arg) {
    StringBuffer proverb = new StringBuffer(); // Capacity is 16
    proverb.append("A").append("B").append("C").append("D").append("E");

    System.out.println(proverb);/*from  w  ww  .j av  a  2 s  .com*/
}

From source file:Main.java

public static void main(String[] arg) {

    StringBuffer buffer = new StringBuffer();

    int i = 123;/*ww w.ja v a2  s .  c  o  m*/
    buffer.append(i);

    System.out.println(buffer);
}