Results 1 to 3 of 3
Thread: What's wrong with this method?
- 01-17-2011, 06:18 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 71
- Rep Power
- 0
What's wrong with this method?
Hi folks
I've written a method, code below
but keep getting the error ')' expected on the following line:Java Code:public void transfer(MoneyFrog aFrog){ double aDouble; aDouble = this.account.getBalance(); this.account.transfer(aFrog aDouble); }
Java Code:this.account.transfer(aFrog aDouble);
The line this.account.transfer(aFrog aDouble) calls a method in another object (account no less) that has two arguments of Account(the MoneyFrog object in this case) and a double (aDouble).
Here's the method in the Account class:
What's wrong with my syntax here? I can't figure it out.Java Code:public boolean transfer(Account toAccount, double anAmount) { if (this.debit(anAmount)) { toAccount.credit(anAmount); return true; } else { return false; }
Thanks i advance
- 01-17-2011, 06:42 PM #2
Don't you think you are missing a comma between the parameters?
should beJava Code:this.account.transfer(aFrog aDouble);
GoldestJava Code:this.account.transfer(aFrog, aDouble);
Java Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-17-2011, 07:16 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 71
- Rep Power
- 0
Similar Threads
-
method return statement is wrong
By ftrengnr in forum New To JavaReplies: 1Last Post: 10-19-2010, 04:15 AM -
method not abstract, does not override actionperformed method.
By Theman in forum New To JavaReplies: 2Last Post: 03-26-2010, 05:12 PM -
Wrong output (well.. the one who's wrong is probably me ;) )
By shacht1 in forum New To JavaReplies: 2Last Post: 11-22-2009, 03:48 PM -
print out error method for wrong args.
By Implode in forum New To JavaReplies: 9Last Post: 09-20-2009, 12:46 PM -
What did i do wrong on thing method?
By PureAwesomeness in forum New To JavaReplies: 9Last Post: 03-08-2009, 08:37 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks