字符串反转

字符串反转

public class StringReverseExample {//字符串反转

public static void main(String[] args) {

String string = "runoob";

String reverse = new StringBuffer(string).reverse().toString();

System.out.println("字符串反转前:"+string);

System.out.println("字符串反转后:"+reverse);

}

}

 

posted @ 2021-10-10 20:54  慢漫曼蔓  阅读(12)  评论(0)    收藏  举报