Java StringBuffer???÷?
???????????? ???????[ 2015/11/26 11:55:58 ] ???????????????
?????????StringBuffer ?????????????String???????????????
????StringBuffer result = null;
??????????棺Null pointer access: The variable result can only be null at this location
???????к???????????StringBuffer??String?????к?????????????Щ??????????????????
???????2????????http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html
????StringBuffer???String????????????????????????????StringBuffer????????????String?????????StringBuffer????????????????????????μ???????????????????String??
???????????????????????????????????????????????????????????????????StringBuffer?????????Щ??
??????StringBuffer???д??????String??????????????Щ????????????String???е???????????????
????????????????????????????????StringBuffer??????????????????????????????String????????
????????????StringBuffer???????????????????????????????????н???????????????????????????????????????????????Ч???????????????Щ??
????1??StringBuffer?????????
????StringBuffer?????????????String????????????Java??????????????????????????????ù????????г??????
???????磺
????StringBuffer s = new StringBuffer();
?????????????????StringBuffer?????????????????????????
???????????????????????StringBuffer?????????????
????StringBuffer s = new StringBuffer(“abc”);
?????????????????StringBuffer????????????????”abc”??
??????????????StringBuffer??String???????????????????????????????????????????????????
????StringBuffer s = “abc”; //???????????
????StringBuffer s = (StringBuffer)”abc”; //???????й?????????????
????StringBuffer?????String??????????????????£?
????String s = “abc”;
????StringBuffer sb1 = new StringBuffer(“123”);
????StringBuffer sb2 = new StringBuffer(s); //String????StringBuffer
????String s1 = sb1.toString(); //StringBuffer????String
????2??StringBuffer????÷???
????StringBuffer???е??????????????????????仯???????????????????????????StringBuffer??String??????????
????a??append????
????public StringBuffer append(boolean b)
?????÷??????????????????????StringBuffer??????β????????????????????????÷??????StringBuffer????????????????????磺
????StringBuffer sb = new StringBuffer(“abc”);
????sb.append(true);
?????????sb????????”abctrue”??
???????÷???????????????????????String?????????????????????????SQL????????????磺
????StringBuffer sb = new StringBuffer();
????String user = “test”;
????String pwd = “123”;
????sb.append(“select * from userInfo where username=“)
????.append(user)
????.append(“ and pwd=”)
????.append(pwd);
????????????sb??????????“select * from userInfo where username=test and pwd=123”??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11