Concatenation of characters in Java
Can somebody explain how the line 11 works? Thanks https://code.sololearn.com/cl59bbmGNKWv/?ref=app
That's because every character have its corresponding numeric encoding value (ASCII) and you may imagine it as a mapping between each character and its binary value. In this case, '1' and '2' equivalent to 49 and 50 respectively and hence sum to 99 arithmetically. 🔗 Reference https://www.arduino.cc/en/Reference/ASCIIchart
You are actually doing an arithmetic expression when trying to do a char concatenation. The result would be the sum of numeric encoding value of the chars in either hands. Performing the concatenation after converting them to strings(using toString()) can do the thing that were in your mind.
Zephyr Koo and Seniru Pasan thank you for your answers!
Atila Sabo You're welcome! 😉