public class NewDoWhileDemo { public static void main(String[] args) { String copyFromMe = "golly gee. this is fun."; StringBuffer copyToMe = new StringBuffer(); int i = 0; char c = copyFromMe.charAt(i); do { copyToMe.append(c); c = copyFromMe.charAt(++i); } while (c != 'g'); System.out.println(copyToMe); } }