package com.nwsuaf.test;
public class Test3 {
public static void main(String[] args) {
String str = "hi,hello world! ";
String reverseStr = new StringBuilder(str).reverse().toString();
//或者
StringBuilder rs = new StringBuilder();
for(int i=str.length()-1;i>-1;i--){
rs.append(str.charAt(i));
}
System.out.println(reverseStr);
System.out.println(rs);
}
}
public class Test3 {
public static void main(String[] args) {
String str = "hi,hello world! ";
String reverseStr = new StringBuilder(str).reverse().toString();
//或者
StringBuilder rs = new StringBuilder();
for(int i=str.length()-1;i>-1;i--){
rs.append(str.charAt(i));
}
System.out.println(reverseStr);
System.out.println(rs);
}
}