/**
* @author lautturi.com
* Java example: create a mutable string in java
*/
import java.util.*;
public class Lautturi {
public static void main(String args[]) {
StringBuilder mutableStr = new StringBuilder("hello java");
mutableStr.append(" world") ;
System.out.println(mutableStr);
mutableStr.append(" lautturi") ;
System.out.println(mutableStr);
String str = mutableStr.toString();
System.out.println(str);
}
}Socrue:www.lautturi.comoutput:
hello java world hello java world lautturi hello java world lautturi