3
Feb 08 '22
The error in line 218.
i am taking 2 inputs from the user and want to print both the inputs in a string in one line. Can someone help?
18
u/SuspendedResolution Feb 08 '22
You need to have "+" when changing between data types in a print statement if I remember correctly
0
2
u/R007E Feb 08 '22
You're missing + b/w string and variable
0
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 +
1
2
8
u/Maleficent-Rest5207 Feb 08 '22 edited Feb 08 '22
When you want to concatenate two strings you can either use + symbol or .concat() method.