大华的一道面试题:
package cn.zstu.mytest;
import org.junit.Test;
/**
* 字符串的反转
* 例 s="hello",return "olleh"
* @author faz
*
*/
public class StringReverse {
public String stringRever(String s) {
StringBuilder sb = new StringBuilder(s);
String newString = sb.reverse().toString();
return newString;
}
@Test
public void main() {
System.out.println(stringRever("hello"));
}
}
最后
以上就是明理银耳汤最近收集整理的关于字符串反转的简单实现方式的全部内容,更多相关字符串反转内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复