Java 实例 - 字符串反转

Java 教程 · 2019-02-10 07:28:51

以下实例演示了如何使用 Java 的反转函数 reverse() 将字符串反转:

StringReverseExample.java 文件

public class StringReverseExample{ public static void main(String[] args){ String string="codercto"; String reverse = new StringBuffer(string).reverse().toString(); System.out.println("字符串反转前:"+string); System.out.println("字符串反转后:"+reverse); } }

以上代码实例输出结果为:

字符串反转前:codercto
字符串反转后:boonur

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

Where Wizards Stay Up Late

Where Wizards Stay Up Late

Katie Hafner / Simon & Schuster / 1998-1-21 / USD 16.00

Twenty five years ago, it didn't exist. Today, twenty million people worldwide are surfing the Net. "Where Wizards Stay Up Late" is the exciting story of the pioneers responsible for creating the most......一起来看看 《Where Wizards Stay Up Late》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换