import javax.swing.*; class BuildString { public static void main(String[] args) { StringBuffer myStr; // start with the empty string myStr = new StringBuffer(""); System.out.println("So far the string is: " + myStr); myStr.append("Four and seven years ago ago"); System.out.println("So far the string is: " + myStr); myStr.insert(4," score"); System.out.println("So far the string is: " + myStr); int index; index = myStr.indexOf("ago"); myStr.delete(index,index+4); System.out.println("So far the string is: " + myStr); System.exit(0); } }