posted 17 years ago
Because, for each int i,
your adding it to total.
Total is given its default value for type int
(because its an instance variable remember).
So, i is added to this each time.
What is (0 + 1 + 2 + 3 + 4 + ... + 99)?
=> 4950!
best regards.
K
P.S be careful with your wording.
It doesn't throw total. It prints it!
[ June 20, 2008: Message edited by: Keith Nagle ]