请教JAVA编程题“编程实现反转一个字符串并输出”
StringBuffer的常用方法 public int capacity() 这个方法返回字符串缓冲区的当前容量。 public synchronized StringBuffer reverse() 这个方法反转字符串缓冲区中的字符串 public int length() 这个方法返回缓冲区中字符的个数 public synchronized setLength(int newLength) 这个方法设置字符串缓冲区的长度。 public synchronized charAt(int index) 这个方法返回字符串缓冲区中指定位置的字符 public synchronized void setCharAt(int index,char ch) 这个方法将字符串缓冲区中指定位置的字符设置为ch。