0

String + int

Hi, I got lot of times in the challenge code like this : public static void main(String[] args){ String str = "5"; Int i = 10; System.out.println(str+i); } If i try to compile this in the console i got a error. But in the challenge from solo learn there i never got a error. Why?

14th Sep 2017, 6:45 PM
nelzon89
4 Answers
+ 8
The primitive datatype is int (lowercase i), not I (uppercase i). If you correct that it compiles and runs just fine.
14th Sep 2017, 6:51 PM
Tashi N
Tashi N - avatar
+ 3
it should look like this String str = "5"; int i = 10; <<"like tash said int begins with lowercase i" System.out.println(str+i); output is 510
14th Sep 2017, 7:11 PM
D_Stark
D_Stark - avatar
+ 2
maybe 510 :))
14th Sep 2017, 10:16 PM
buran9
buran9 - avatar
+ 1
@buran9 😂 oops corrected
15th Sep 2017, 12:05 PM
D_Stark
D_Stark - avatar