import java.util.Scanner;
/**
* Author: 明明就会被淘汰
* Date: 2022/1/22 下午3:44
* Title:
*/
public class 字符串反转 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入字符串:");
String input = sc.nextLine();
String s = reverse(input);
System.out.println("s:" + s);
}
public static String reverse(String s) {
String ss = "";
for (int i = s.length() - 1; i >= 0; i--) {
ss += s.charAt(i);
}
return ss;
}
}
版权属于:
肚子饿了才有力气吃饭
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)