我想问你StringBuilder sb=new StringBuilder("");和
StringBuilder sb=new StringBuilder();这两者的区别是啥。请讲详细点 谢谢!!
StringBuilder sb=new StringBuilder();这两者的区别是啥。请讲详细点 谢谢!!
解决方案 »
- 求教,做了1年J2EE,想转行做游戏图形渲染,需要学些什么
- orb销毁问题
- extjs tree DWRTreeLoader从数据库读出来的叶节点在页面怎么不能添加子节点啊,但读出来的节点就可以添加子节点
- 学习ajax框架的一些疑惑,望大家给点建议!!!(正在学 prototype)
- hibernate 一对多插入数据失败
- 求一个 jboss 4 连接mysql的例子
- [?????]在tagsupport中的dostartTag和doEndTag这两个方法有什么区别,什么时候该用dostartTag什么时候用doEndTag??
- 在单机(无任何连接)上用weblogic做j2ee程序,遇到的奇怪问题?请朋友们帮忙?
- 读取两个配置文件,为什么打印不出System.out.println(prop1.get(m1Key))????
- 纠结一个问题
- Java nio实现socket通信遇到的问题
- java连接mysql创建数据源时,jdbc驱动程序应该放到glassfish服务器的哪个目录下,怎么过都是ping不成功?
public StringBuilder(int capacity) {
super(capacity);
}
AbstractStringBuilder(int capacity) {
value = new char[capacity];
}
public StringBuilder(String str) {
super(str.length() + 16);
append(str);
}
public StringBuilder append(String str) {
super.append(str);
return this;
}
public AbstractStringBuilder append(String str) {
if (str == null) str = "null";
int len = str.length();
if (len == 0) return this;
int newCount = count + len;
if (newCount > value.length)
expandCapacity(newCount);
str.getChars(0, len, value, count);
count = newCount;
return this;
}
虽然走的路不一样,最终的结果是一样的。
public StringBuilder() {
super(16);
}
super(16);
} /**
* Constructs a string builder with no characters in it and an
* initial capacity specified by the <code>capacity</code> argument.
*
* @param capacity the initial capacity.
* @throws NegativeArraySizeException if the <code>capacity</code>
* argument is less than <code>0</code>.
*/
public StringBuilder(int capacity) {
super(capacity);
}