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[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append(1.2);/*from   ww w.  ja  v  a  2  s .  c  o m*/
    System.out.println(sb.toString());
}

From source file:Main.java

public static void main(String[] args) {
    StringBuffer sb = new StringBuffer();
    System.out.println(sb.capacity());
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append(true);/*from  w w w . ja va  2s.co  m*/
    System.out.println(sb.toString());
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append('a');
    System.out.println(sb.toString());
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");
    System.out.println(sb.toString());
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");
    String sub = sb.substring(1, 2);
    System.out.println(sub);/*from w w w.j  a v a  2s  .com*/
}

From source file:Main.java

public static void main(String[] args) {
    StringBuffer sb1 = new StringBuffer();
    StringBuffer sb2 = new StringBuffer(10);
    StringBuffer sb3 = new StringBuffer("Hello World");
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");

    System.out.println(new String(sb));

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");
    int index = sb.indexOf("a");
    System.out.println(index);/*from  ww w  .  j a v  a 2s.co  m*/

}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");

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