Java实现字符串倒序输出
package Strin;
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
String st="fuck";
System.out.println(st);
StringBuffer sb=new StringBuffer(st);
System.out.println(sb.reverse());
char[] cha= {
'y','o','u'};
String s1=new String(cha);
System.out.println(s1);
for (int i = 2; i >= 0; i--) {
System.out.print(cha[i]);
}
Scanner sc= new Scanner(System.in);
System.out.println("请输入一串字符串");
String s2=sc.nextLine();
for (int i = 0; i < 1; i++) {
for (int j = s2.length()-1; j >=0; j--) {
System.out.print(s2.charAt(j));
}
}
}
}