package com.sise; import java.util.Scanner; public class Test10 { public static void main(String[] args) { System.out.print("请输入字符串:"); Scanner sc = new Scanner(System.in); String x = sc.nextLine(); String y = fanzhuan(x); System.out.println("反转字符串:" + y); } public static String fanzhuan(String s) { StringBuilder sc = new StringBuilder(s); sc.reverse(); String x = sc.toString(); return x; } }
java反转字符串StringBuilder
最新推荐文章于 2024-11-03 11:01:20 发布
关键词由CSDN通过智能技术生成