Differentiate between the function of + operator when used with integer and string value
Answers
Answered by
7
Explanation:
+ operator when used between the 2 or more strings concatenates them all, for example:
String str = "a" + "sample"+"concatenation";
in output the value of str would be "a sample concatenation"
and when + operator is used between the integer variables, add the values of them, for example:
int val = 5+6+7;
in output the value of val would be 18.
Similar questions
Social Sciences,
6 months ago
Biology,
1 year ago