0

print("5" + "3") Why was the output 53 ?

15th Apr 2017, 1:33 PM
AidilSha 6
AidilSha 6 - avatar
3 Réponses
+ 21
As 5 written in double inverted commas("5"): Its a String....and as so 3, they are not the numbers but they are Strings, If you add an String to another string the output would be: "5" + "3" = 53 and in an int, double, float or long case: 5 + 3 = 8; Remember when we add double inverted commas to anything, it becomes a String😎
15th Apr 2017, 1:40 PM
Dev
Dev - avatar
+ 4
Putting " around something makes it a string. So it makes it a character with no numerical value. So "a" + "b" = ab
15th Apr 2017, 1:41 PM
Chase
0
8
7th Aug 2024, 9:49 AM
Smaran kishoreurs
Smaran kishoreurs - avatar