请问一下String.valueOf问题

stoneopen1 2003-04-30 08:48:04
public void initArray()
{
ResultArray ra = new ResultArray();
ra.open();
String strSql = String.valueOf(String.valueOf((new StringBuffer("select name,name from type_cityarea where agentno = '")).append(strAgentNo).append("'")));
arrCityArea = ra.getList(strSql);
strSql = String.valueOf(String.valueOf((new StringBuffer("select name,name from type_contact where agentno = '")).append(strAgentNo).append("'")));
arrContactType = ra.getList(strSql);
strSql = String.valueOf(String.valueOf((new StringBuffer("select prop.rs_guid,prop.property_name from usr_con_pro as prop where prop.agen" +
"tno = '"
)).append(strAgentNo).append("'")));
arrOther = ra.getList(strSql);
ra.close();
}



请问一下这句怎么理解啊String.valueOf(String.valueOf((new StringBuffer
为什么要用两个String.valueOf,String.valueOf是什么意思啊,
...全文
167 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
stoneopen1 2003-04-30
  • 打赏
  • 举报
回复
谢谢拉,可是英语不怎么看的懂,不怎么好理解,能够通俗一点吗
老土豆T 2003-04-30
  • 打赏
  • 举报
回复
public StringBuffer(String str)
Constructs a string buffer so that it represents the same sequence of characters as the string argument; in other words, the initial contents of the string buffer is a copy of the argument string. The initial capacity of the string buffer is 16 plus the length of the string argument.

===============================================

public static String valueOf(char[] data)
Returns the string representation of the char array argument. The contents of the character array are copied; subsequent modification of the character array does not affect the newly created string.

Parameters:
data - a char array.
Returns:
a newly allocated string representing the same sequence of characters contained in the character array argument.
========================================================

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧