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

  

原文地址:https://www.cnblogs.com/langlove/p/3458732.html