Quote:
Originally Posted by truBlu1
I have another question. Look at this segment of code. When my program outputs, it is concatenating the numbers as if they were strings. I get output like 1 + 13 = 113. Why does this happen? I've already fixed the problem by creating an integer variable and setting it equal to numbers[i]+numbers[(n-1)-i] but I'm still curious.
|
See the documentation for the
String class:
Quote:
|
Originally Posted by Java String Documentation
The Java language provides special support for the string concatenation operator ( + ), and for conversion of other objects to strings. ... String conversions are implemented through the method toString, defined by Object and inherited by all classes in Java.
|