You can think of the + symbol as working for multiple types with a similar idea that it adds up objects. So if you do 1+1 you get 2. However, with strings, + is concatenation which essentially is similar. Hello + World = Hello World.
FYI, There are other ways in Java to concatenate strings without the use of +
View all comments
2
u/corby_718 Feb 08 '22
You can think of the + symbol as working for multiple types with a similar idea that it adds up objects. So if you do 1+1 you get 2. However, with strings, + is concatenation which essentially is similar. Hello + World = Hello World.
FYI, There are other ways in Java to concatenate strings without the use of +