赞
踩
- public class Test {
- public static void main(String[] args) {
-
- //String ------- StringBuffer
- String s = "hello";
-
- //通过构造方法
- StringBuffer buffer = new StringBuffer(s);
- //通过append()方法
- StringBuffer append = new StringBuffer().append(s);
- //通过insert()方法
- StringBuffer insert = new StringBuffer().insert(0, s);
-
-
- //StringBuffer ------- String
- StringBuffer sb = new StringBuffer("HelloWorld");
-
- //通过toString()方法
- String s1 = sb.toString();
- //使用substring方法
- String substring = sb.substring(0);
- //通过构造方法
- String s2 = new String(sb);
-
-
- }
- }
(小编也在努力学习更多哟!以后会多多分享哒!)希望对友友们有所帮助!!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。