Skip to content

Instantly share code, notes, and snippets.

@nickserv
Last active December 24, 2015 06:49
Show Gist options
  • Save nickserv/6759236 to your computer and use it in GitHub Desktop.
Save nickserv/6759236 to your computer and use it in GitHub Desktop.
Java: StringBuilder Example
import java.lang.StringBuilder;
public class StringBuilderExample {
public static void main(String args[]) {
String s = "";
s += "I have ";
s += 50;
s += " cats.";
System.out.println(s);
StringBuilder sb = new StringBuilder();
sb.append("I have ");
sb.append(50);
sb.append(" cats.");
System.out.println(sb);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment