Closed cuneyt76 closed 7 months ago
Ah, yes! But that's because the compiler inserts an automatic conversion from int to double, and the actual addition is done between two double values, with a double result.
Hm, understood. Thanks for the inner details. But still, the sentence, in its current form, might be a bit confusing / might require additional explanation especially for beginners. When I first read it, I thought [although my intuition told me otherwise] it effectively said you could not add an int and a double (and expected to see an error when I attempted to do so -similar to the one we encounter when we attempt to add an int and, say, a string).
Hello, From page 58: "For example, addition is defined between two ints and two doubles but not between an int and a double." Is there something wrong with the sentence above? Isn't it perfectly legal to add int a and double b as in: