CCI习题 1-2:Reverse String

package question1_2;


public class Question {
public static String reverseString(String str){
if(str.equals(null)){
return null ;
}
StringBuffer sBuffer=new StringBuffer(str);
String strResult=sBuffer.reverse().toString();
return strResult;
}

public static void main(String[] args){
String strTest="abc";
String strReString=reverseString(strTest);
System.out.println(strTest+"_"+strReString);
}
}

你可能感兴趣的:(CCI习题 1-2:Reverse String)