i 绝望

依然

Miss Lang

java代码反转toCharAT()的用法

总结:反转注意for循环里面的变化

package clientFrame;

//字符串反转
public class we {

	public static void main(String[] args) {
		String s = "A quick brown fox jumps over the lazy dog.";
		System.out.println("源字符串是:" + s);
		System.out.print("反转后的字符串是:");
		for (int i = s.length(); i > 0; i--) {

			System.out.print(s.charAt(i - 1));
		}
	}
}

源字符串是:A quick brown fox jumps over the lazy dog.
反转后的字符串是:.god yzal eht revo spmuj xof nworb kciuq A

  

posted on 2013-12-05 07:32  juewang  阅读(756)  评论(0编辑  收藏  举报

绝望依然

Miss Lang