开发者

StringBuffer , StringBuidler

开发者 https://www.devze.com 2023-01-26 02:38 出处:网络
StringBuidler sb=\"ram\" StringBuffer sf = \"ram\" Both throws comile ti开发者_开发问答me error .

StringBuidler sb="ram" StringBuffer sf = "ram"

Both throws comile ti开发者_开发问答me error . Please explain Why??????


There's no promotion from String to StringBuilder/Buffer. Try

StringBuilder = new StringBuilder("ram")


Because StringBuilder and StringBuffer isn't strings. You need to write

sb = new StringBuilder("ram")


Perhaps because it is "StringBuilder" not "StringBuidler"?
Or maybe because you need a semi-colon between the two lines?
Or that "ram" is a string and not a StringBuilder or StringBuffer?

0

精彩评论

暂无评论...
验证码 换一张
取 消