Skip to content

Instantly share code, notes, and snippets.

@kenorb
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save kenorb/7b58291904029357216f to your computer and use it in GitHub Desktop.

Select an option

Save kenorb/7b58291904029357216f to your computer and use it in GitHub Desktop.
StringBuffer class Demo.
/*
* StringBufferDemo.java
*
* StringBuffer class Demo.
*
* A thread-safe, mutable sequence of characters.
* A string buffer is like a String, but can be modified.
* At any point in time it contains some particular sequence of characters,
* but the length and content of the sequence can be changed through certain method calls.
*
* Usage:
* javac StringBufferDemo.java && java StringBufferDemo
*/
class StringBufferDemo {
public static void main(String args[]) {
StringBuffer sb = new StringBuffer("hello");
sb.append("java");
System.out.println(sb);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment