it depends on whether you're updating sumOfBeginningBalances or the method currentAccount.getBalance(). what preceded this in the pseudocode? this will affect what you'll do. my gut suggests your second option but w/o the benefit of the specifications it is only a guess.
Imagination is more important than knowledge "Albert Einstein"
Joined: Apr 03, 2008
That's the million dollar question.
In the application I'm working with multiple accounts, and the sumOfBeginningBalances it the total for all accounts. In this method, I'm working with only one of those accounts.
I'm "guessing" I'm updating the sum.
I'm sure I'm microanalizing too much. Until I get the beginningBalance it's initialized at 0.0, so it updates, but the sum is also 0.0 until it updates the first time.
This is the first line of this method BTW.
Also, I'll throw in another question, for when I get this done.
In a conditional coding, if I want both conditons to be true before it does the statement that's "&"?
& checks both conditions? && stops if first is false?
Thanks [ April 13, 2008: Message edited by: Richard Chambers ]
For the first question, only the second one is legal Java. The left operand of the "+=" operator must be a variable. Since you've got a sum, and want to add more to it, then the second one is not only the legal one, but also the one that makes sense.
For the second question both operators will do the right thing, but "&&" will do less work in some cases. For both of these, the controlled statement will only be executed if both the conditions are true. The difference is that "&" will always execute both conditions. The "&&" operator will say "Hey, the first condition was false, so I don't care what the second one evaluates to, since it doesn't matter; I'm not going to execute the statement no matter what, so I'll just skip it."