Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2007, 06:53 PM
Member
 
Join Date: Nov 2007
Posts: 36
dirtycash is on a distinguished road
compile error
....................

Last edited by dirtycash : 12-12-2007 at 08:02 PM. Reason: question answered
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-12-2007, 07:25 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
Inside your Account class you need a constructor that handles two strings.

Code:
public Account(String email, String password){ /* Do something with Strings. Probably set them equal * to the email and password fields in the Account class. */ }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-12-2007, 07:29 PM
Member
 
Join Date: Nov 2007
Posts: 36
dirtycash is on a distinguished road
i have this already

Code:
public Account(String email, String pwd, int balance, ArrayList transactions) { this.email = email; password = pwd; balance = 0; transactions = new ArrayList<String>(); }
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-12-2007, 07:34 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
Yeah but you need a constructor with the right signature. If you are going to pass it two Strings, then you need a constructor that handles two Strings like the one I put above. It is possible and usually a good idea to have more than one constructor.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-12-2007, 07:41 PM
Member
 
Join Date: Nov 2007
Posts: 36
dirtycash is on a distinguished road
so i have to create a new constructor just handling the 2 strings?
i dont understand would it not function just the same as the one i have already?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-12-2007, 07:51 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
Code:
Account Account = new Account(email, password);
So this is the call that you are trying to make. Since you are passing two Strings, the compiler is looking for a constructor that accepts two strings. The one that you have:

Code:
public Account(String email, String pwd, int balance, ArrayList transactions) { this.email = email; password = pwd; balance = 0; transactions = new ArrayList<String>(); }
accepts more arguments than the two Strings that the compiler is looking for so it doesn't think that the method exists (and it doesn't).

It actually would function the same as the one you already have. Look at your code again. You pass in the int balance and the ArrayList transactions but you don't actually do anything with them. You hardcode the account balance to 0 and create a new ArrayList instead of using the one that you passed.

So just copy that code and get rid of the int and ArrayList that you are passing in.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 12-12-2007, 08:00 PM
Member
 
Join Date: Nov 2007
Posts: 36
dirtycash is on a distinguished road
i see thanks for explaining that to me
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Trouble adelgado0723 New To Java 5 04-21-2008 04:02 AM
How to compile an applet to an exe elizabeth Java Applets 4 02-18-2008 05:57 AM
Unable to compile gapper New To Java 2 01-14-2008 06:31 PM
Not able to compile bugger New To Java 2 01-10-2008 12:13 AM
Compile a program toby New To Java 2 07-30-2007 11:09 AM


All times are GMT +3. The time now is 03:44 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org