• 2022-06-07
    写出下面程序的输出结果 publicclassTestjava{ publicstaticvoidmain(String[]args){ Strings1="abcdefhij"; Strings2=""; char[]cs=s1.toCharArray(); for(inti=cs.length-1;i>=0;i--){ s2=s2+cs[i]; } System.out.println("输出的结果1:"+s2); StringBuffersb=newStringBuffer(s1); StringBuffersb2=sb.reverse(); System.out.println("输出的结果2:"+sb2); Strings3=myReverse(s1); System.out.println("输出的结果3:"+s3); } publicstaticStringmyReverse(Stringstr) { char[]arr=newchar[str.length()]; intpos=str.length(); for(intx=0;x[/i]