使用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()); } }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/15871.html