Results 1 to 8 of 8
- 05-09-2011, 05:15 PM #1
Member
- Join Date
- May 2011
- Posts
- 4
- Rep Power
- 0
The constructor Bucket(int) is undefined
Hello
I am trying to practice Java, I have a test on Wednesday.
When I try to write this:
Bucket[] arr= new Bucket[6];
arr [0]= new Bucket(6);
The underlined text, new Bucket(6) is underlined in red, and the reason is: "The constructor Bucket(int) is undefined".
The class Bucket has no problems in its constructor, and it is imported to my class correctly.
The constructor of the Bucket class,
public Bucket (int capacity)
{
this.capacity = capacity;
this.currentAmount = 0;
}
requires only one int operator.
So what is the problem??
Please help me soon!!
Yairku
- 05-09-2011, 05:18 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 05-09-2011, 05:36 PM #3
Member
- Join Date
- May 2011
- Posts
- 4
- Rep Power
- 0
Okay, it can't find a constructor Bucket(int);
Why that occurs and what should I do in order to fix it?
Thanks
- 05-09-2011, 05:59 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 05-09-2011, 06:12 PM #5
Member
- Join Date
- May 2011
- Posts
- 4
- Rep Power
- 0
The problem has been solved!
I don't know why, but I had to write Bucket(int, String), although it is not written in the Bucket class.
Thank you very much for trying to help,
Yair
- 05-09-2011, 06:13 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
As Jos has asked, you'll need to show us the code.
- 05-09-2011, 06:38 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 05-09-2011, 08:19 PM #8
Member
- Join Date
- May 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
bucket sort, list in java
By someone in forum New To JavaReplies: 10Last Post: 04-12-2011, 12:13 AM -
problem with my bucket sort
By someone in forum New To JavaReplies: 8Last Post: 04-12-2011, 12:09 AM -
Undefined attribute name
By Dieter in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 05-03-2010, 11:44 AM -
The constructor Person(String, String, Date) is undefined
By fh84 in forum New To JavaReplies: 7Last Post: 11-03-2009, 03:18 AM -
Remove the bucket represented by the int from array
By barney in forum New To JavaReplies: 1Last Post: 08-01-2007, 09:55 AM
Bookmarks