我需要用户输入一个单词和代码以交换字符串中的第一个和最后一个字符,例如'hello'应该输出'oellh'
public void compute(){
for (int i = 0; i < name.length(); i++){
if (name.length() > 2 ) {
}
else {
strBuff.append(name.charAt(i));
}
}