I get 55 for my aDouble variable. And there's something wrong with that?
That's the correct answer.
0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
Not that i would want to, but how would one be able to iterate as many times equal to the MAX_VALUE value of double? Is the extent of iteration limited to an int? Ummm... you can easily loop with a long rather than int, so it's not limited to int. However using a double is a bad idea. If you keep adding 1 to it, eventually the number will be so big that when you add 1, it has no effect, due to roundoff error. E.g. if you use doubles to add 1e100 + 1, you just get 1e100 again. So you'll never reach Double.MAX_VALUE.