Discuss / Java / zsbd

Source

#1 Created at ... [Delete] [Delete and Lock User]

String s = ""+ (char)a + (char)b + (char)c;

结果为Hi!

俗雅

#2 Created at ... [Delete] [Delete and Lock User]

你好,前面为什么要加“”  这个空字符串呢?

Astrophel

#3 Created at ... [Delete] [Delete and Lock User]

如果不加空字符串,相当于三个char类型相加,结果为int,print结果为abc三个整数之和;加了后相当于字符串末尾加三个字符,结果为abc对应的Unicode拼接而成的字符串。


  • 1

Reply