关于String对象常量的问题

设String对象 s = "H",运行语句system.out.printl(s.concat("ello!));后String对象的内容为"Hello!",所以输出为"Hello!"
大家看看这句话有没错,若有错请指出哪里错???

第1个回答  2013-07-22
输出为Hello!的原因不是String对象s的内容为"Hello!"
而是因为concat方法返回了一个新的String对象,这个新的String对象内容为Hello!本回答被提问者采纳
第2个回答  2013-07-19
system.out.printl(s.concat("ello!"));
//没错掉了个反引号

追问

那是我打的时候漏加的,补上那个引号,你再看有什么问题!

追答

相似回答