JavaSE8基础 StringBuffer reverse 倒置缓冲区内的字符串

os :windows7 x64
    jdk:jdk-8u131-windows-x64
    ide:Eclipse Oxygen Release (4.7.0)
    
    
code:

package jizuiku1;

public class Demo101 {
	public static void main(String[] args) {
		StringBuffer sb = new StringBuffer();
		sb.append("cnblog");

		sb.reverse();//倒置字符串

		System.out.println(sb);
	}
}

result:



Java优秀,值得学习。
学习资源:API手册+Java源码+清净的心地。

时间: 2024-10-25 00:48:56

JavaSE8基础 StringBuffer reverse 倒置缓冲区内的字符串的相关文章

JavaSE8基础 StringBuffer与String变量在追加字符串后,引用变量的地址发生改变

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku0; public class Demo11 { public static void main(String[] args) { String str1 = "cnblog"; String str2 = str1 + "jizuiku"; S

JavaSE8基础 StringBuffer append 向缓冲区中变量的末尾追加字符串与缓冲区容量的自动扩充

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku1; public class Demo000 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); System.out.println("缓冲容的容量是:"

JavaSE8基础 StringBuffer 将一个char字符重复指定次数后输出

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0) code: package jizuiku0; /* * @version V17.09 */ public class repeatCharDemo { public static void main(String[] args) { // 字符 0 重复输出3次 System.out.println(repeatChar('0

JavaSE8基础 StringBuffer delete trimToSize 清空字符串缓冲区与整理缓冲区的空间

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku1; public class Demo100 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append("cnblog"); System.

JavaSE8基础 StringBuffer substring 将变量分割返回String,其本身不变

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku1; public class Demo110 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append("cnblog"); String

JavaSE8基础 StringBuffer toString 将其转为String对象

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku0; public class Demo10 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append("cnblog_"); sb.appe

JavaSE8基础 StringBuffer的三种构造方法

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku0; public class Demo00 { public static void main(String[] args) { //无参构造 StringBuffer sb = new StringBuffer();//看API手册+源码可得,初始容量为16 System

JavaSE8基础 StringBuffer delete 删除指定索引值的一个字符

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku1; public class Demo010 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append("cnblog_").append(

JavaSE8基础 String concat与+ 连接两个字符串

os :windows7 x64    jdk:jdk-8u131-windows-x64    ide:Eclipse Oxygen Release (4.7.0)        code: package jizuiku.t02; public class Demo { public static void main(String[] args) { String s1 = "cnblog"; String s2 = "jizuiku"; String res1