/** * 将字符串倒序 */ public static void reverseStr() { StringBuffer sb = new StringBuffer("This is a StringBuffer!"); // reverse方法将字符串到序 System.out.println(sb.reverse()); }