Java经典实例:按字符颠倒字符串
使用StringBuilder类的reverse()方法来实现。
/** * Created by Frank */ public class StringRevChar { public static void main(String[] args) { String sh = "ABCDEFG"; System.out.println(sh + "->" + new StringBuilder(sh).reverse()); } }
使用StringBuilder类的reverse()方法来实现。
/** * Created by Frank */ public class StringRevChar { public static void main(String[] args) { String sh = "ABCDEFG"; System.out.println(sh + "->" + new StringBuilder(sh).reverse()); } }