字符串反转

来源:互联网 发布:2017教师网络研修网 编辑:程序博客网 时间:2024/05/16 15:47

代码:

  1. public class fan{  
  2.     public static void main(String[]args) {  
  3.         String s1 = "abc23d";  
  4.         for(int i=s1.length()-1;i>=0;i--){  
  5.             System.out.print(s1.charAt(i));  
  6.         }  
  7.     }  


运行结果: