package com.cc;
public class Hello {
//方法一:
// public static void main(String[] args) {
// reverse("1234;abcd");
// }
// //倒序输出字符串
// public static void reverse(String dest){
// if(dest.length() == 1){
// System.out.print(dest);
// }else{
// String str1 = dest.substring(0,dest.length()-1);
// String str2 = dest.substring(dest.length()-1);
// System.out.print(str2);
// reverse(str1);
// }
// }
//方法二:
// public static void main(String[] args) {
// StringBuffer sb = new StringBuffer("abcd;1234");
// System.out.println(sb.reverse().toString());
// }
//方法三:
public static void main(String[] args) {
String str = "abcd;1234";
char[] charArray = str.toCharArray();
for(int i = charArray.length-1; i>=0;i--){
System.out.print(charArray[i]);
}
}
}
public class Hello {
//方法一:
// public static void main(String[] args) {
// reverse("1234;abcd");
// }
// //倒序输出字符串
// public static void reverse(String dest){
// if(dest.length() == 1){
// System.out.print(dest);
// }else{
// String str1 = dest.substring(0,dest.length()-1);
// String str2 = dest.substring(dest.length()-1);
// System.out.print(str2);
// reverse(str1);
// }
// }
//方法二:
// public static void main(String[] args) {
// StringBuffer sb = new StringBuffer("abcd;1234");
// System.out.println(sb.reverse().toString());
// }
//方法三:
public static void main(String[] args) {
String str = "abcd;1234";
char[] charArray = str.toCharArray();
for(int i = charArray.length-1; i>=0;i--){
System.out.print(charArray[i]);
}
}
}