2nd May 2017, 6:42 PM
It24
3 ответов
+ 24
+ works as concatenation (joining) operator. So 2*2+2/2 = 4+1 = 41 If you want 5 as output, then use parentheses as follows : (2*2+2/2)
2nd May 2017, 6:53 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 9
System.out.println("4+4/2*3="+2*2+2/2); outputs 4+4/2*3=41 because first a string is printed, so the results of the calculations 2*2 (=4) and 2/2 (=1) are concatenated to the string 41.
2nd May 2017, 6:56 PM
Tashi N
Tashi N - avatar