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://www.codercto.com/courses/l/12.html

查看所有标签

Introduction to the Design and Analysis of Algorithms

Introduction to the Design and Analysis of Algorithms

Anany Levitin / Addison Wesley / 2011-10-10 / USD 117.00

Based on a new classification of algorithm design techniques and a clear delineation of analysis methods, Introduction to the Design and Analysis of Algorithms presents the subject in a coherent a......一起来看看 《Introduction to the Design and Analysis of Algorithms》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具