字符串倒叙输出,StringBuffer,String
来源:互联网 发布:注册六西格玛黑带 知乎 编辑:程序博客网 时间:2024/05/17 18:01
package test;import java.util.Scanner;public class LianXi { public static void main(String[] args) { String s; System.out.println("input"); s = new Scanner(System.in).nextLine(); StringBuffer sb = new StringBuffer(s); System.out.println(sb.reverse().toString());// LianXi.otherMethod(); } public static void otherMethod() { String s = ""; System.out.println("input:"); s = new Scanner(System.in).nextLine(); char[] c = s.toCharArray(); for (int i = c.length - 1; i >= 0; i--) { System.out.print(c[i]); } }}/*StringBufferStringBuffer(String str)Constructs a string buffer initialized to the contents of the specified string.StringBuffer reverse()Causes this character sequence to be replaced by the reverse of the sequence.Stringchar[] toCharArray()Converts this string to a new character array. */
阅读全文
0 0
- 字符串倒叙输出,StringBuffer,String
- 将字符串倒叙输出
- 字符串倒叙输出
- Java 字符串倒叙输出
- OC 中字符串倒叙输出
- java 冒泡排序和字符串倒叙输出
- 几种倒叙输出字符串的方式
- 字符串倒叙
- 面试问题,将字符串、字符串单词倒叙输出
- java字符串String&StringBuffer
- 字符串(String、StringBuffer、StringBuilder)
- 字符串String,StringBuffer,StringBuilder
- Java字符串 String StringBuffer
- java 将字符串倒叙输出的最简便方法
- 给你一组字符串让你把它倒叙输出
- 递归之倒叙输出
- 倒叙输出一组数组
- 分解整数倒叙输出
- nano pi 使用无线扩展板教程-无线模块的使用
- Linux基本操作
- Android 7.0 增加以太网设置DHCP和静态IP
- javascript中屏蔽esc键
- HTML5 canvas电子签名与截图
- 字符串倒叙输出,StringBuffer,String
- try catch && tran
- Dubbo学习总结(1)——Dubbo入门基础与实例讲解
- iOS下Html页面中input获取焦点弹出键盘时挡住input解决方案—scrollIntoView()
- Rust绿色版(Win10)制作&安装教程
- [TensorFlow] Ubuntu16.04 更新最新的pip3 正确方式
- 立体匹配十大概念综述---立体匹配算法介绍
- Android Service
- Java算法