用JAVA帮我写下反转一个字符串!!!谢谢大家了

解决方案 »

  1.   

    new StringBuffer("xxxxx").reverse().toString();
      

  2.   

    楼上正解楼主你要的结果如下:public static void main(String[] args) 
    {
    StringBuffer sb = new StringBuffer("abcdefg"); System.out.println(sb.reverse().toString());
    }
      

  3.   

    public class Test 
    {
      public static void main(String[] args)
      {
      String str0="abcdef";
      str0=((new StringBuffer(str0)).reverse()).toString();
      System.out.println(str0);
      }
    }
      

  4.   

    public class Test
    {
             public static void main(String[] args)
             {
    System.out.println(doChanged("abcde"));

    }

    public static String doChanged(String str)
    {
    String s=new String("");
    for(int i=str.length()-1;i>=0;i--)
    {
    s+=str.charAt(i);
    }
    return s;
    }
      

  5.   

    汗,少了个括号
    ===============
    public class Test
    {
             public static void main(String[] args)
             {
    System.out.println(doChanged("abcde"));

    }

    public static String doChanged(String str)
    {
    String s=new String("");
    for(int i=str.length()-1;i>=0;i--)
    {
    s+=str.charAt(i);
    }
    return s;
    }
    }
      

  6.   

    jy02209334() ( ) 信誉:100    Blog 
    不是写出来了么?
      

  7.   

    public synchronized StringBuffer reverse() {
    if (shared) copy();
    int n = count - 1;
    for (int j = (n-1) >> 1; j >= 0; --j) {
        char temp = value[j];
        value[j] = value[n - j];
        value[n - j] = temp;
    }
    return this;
        }
      

  8.   

    luyang1016(闭月羞花猫) ( ) 信誉:100    Blog  2006-11-22 12:34:53  得分: 0   
     
       jy02209334() ( ) 信誉:100    Blog 
    不是写出来了么?
      =================
    多种方法哈初学的话不能一味依赖库滴