I've done this in Java before but I can't remember how exactly.
You create a String:
String foo = "She %s sea shells by the seashore.";
Then you can write into the String the word "sells".
What do you use for that?
You're looking for the Formatter class, or the String.format convenience method:
String.format(foo, "sells");
Straight from the source (and my bookmarks)...
StringBuilder sb = new StringBuilder();
// Send all output to the Appendable object sb
Formatter formatter = new Formatter(sb, Locale.US);
// Explicit argument indices may be used to re-order output.
formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d");
UPDATE: Sorry meant to include the link: http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html