您的位置:首页 > 编程语言 > Java开发

Java 字符串反转

2016-10-28 17:02 274 查看
/**
* Reverse 字符串反转
* @author Mitten_Crab
* @date 2016年10月28日 下午 5:00:50
*/
public class Reverse{

public static void main(String[] args) {

String str = "Bring Watch";
String reverse = reverse(str);
System.out.println(reverse);

}

// 使用 StringBuffer 的 reverse() 方法
public static String reverse(String str) {
return new StringBuffer(str).reverse().toString();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息