package com.imooc;class ReverseStr {public static String reverseIt(String source){ int i,len=source.length(); StringBuilder dest=new StringBuilder(len); for(i=(len-1);i>=0;i--){ dest.append(source.charAt(i)); } return dest.toString();}}class Myrever{ public static void main(String[] args){ System.out.println("abcdefg is reversed to:"+ReverseStr.reverseIt("abcdefg")); }}
添加回答
举报
0/150
提交
取消