0
Thread for (my) challenges
Locating my or quizzes' authors' mistakes. edit: Should've tested on my own, but still [ANSWERED] { can we write so String s1 = "sth" +1; Seems that int and String are incompatible.}
2 Réponses
+ 16
Yes, it's allowed in Java. The value of s1 will be sth1. You can check it here :
https://code.sololearn.com/cIDsUE4bu85L/?ref=app
For more details on concatenation, view this post :
https://www.sololearn.com/discuss/257539/?ref=app
+ 1
The + operator is implemented with the StringBuilder's append method. The append method is overloaded to allow appending many different types. Therefore, you can plus float, int, char and a few others.