total = sum + sum
Did that code compile? It's better if you compile and execute the code BEFORE posting it.
That looks the same as: total = 2*sum;
Where is the value from the last call to...
Type: Posts; User: Norm
total = sum + sum
Did that code compile? It's better if you compile and execute the code BEFORE posting it.
That looks the same as: total = 2*sum;
Where is the value from the last call to...
If a method is NOT called, it does not execute. If it does not execute, it will not compute any value.
--- Update ---
If you want to accumulate the sum of previous values with the current...
BTW m is a poor name for a method. The name of a method should be a verb saying what the method is doing.
Where is the m method called?
What does the program print out when it executes? Can you copy the exact output and not interpret it in text?
BTW m is a poor name for a method. The name of a method should be a verb saying what...
What happens when you compile and execute the code? Copy the output and paste it here. Add some comments to the posted output showing what the output should look like.