// A short program to demonstrate a StringBuilder which is a mutable String public class StringBuilderExample { public static void main(String[] args) { StringBuilder sb = new StringBuilder(100); // this StringBuilder can store up to 100 chars for(int i=0;i<26;i++) sb.append((char)(i+'a')); // fill this String with the characters 'a' through 'z' one at a time System.out.println(sb); // show the result for(int i=25;i>=0;i=i-3) // starting at the tail end, delete every third character sb.deleteCharAt(i); sb.reverse(); // reverse the order of the chars in the String System.out.println(sb); // output the result of the deletions and reversal } }