Results 1 to 4 of 4
Thread: Stuck on an error
- 03-23-2010, 06:20 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 4
- Rep Power
- 0
Stuck on an error
:confused: I get the following error: java:210: compareTo(java.lang.String) in java.lang.String cannot be applied to (Competition)Java Code:public int findIndex(Competition x) { int count = 0; for(CompetitionNode current = head; current != null; current = current.next) { if (current.c.getCompetitionName().compareTo(x) == 0) { return count; } count ++; } }
- 03-23-2010, 06:29 AM #2
Member
- Join Date
- Mar 2010
- Posts
- 4
- Rep Power
- 0
Nevermind, solved.
- 03-23-2010, 06:32 AM #3
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
I have to do some guessing here, because you've only shared a bit of your code. (But thank you for using CODE tags properly!)
I take it the "c" member variable of a CompetitionNode object is of type Competition? In any case, its getCompetitionName() method returns a String (which seems reasonable). You are trying to compare that String to a Competition named x. Maybe you mean to do this?
And maybe this would be even more straightforward for you?Java Code:if (current.c.getCompetitionName().compareTo(x.getCompetitionName()) == 0)
-Gary-Java Code:if (current.c.getCompetitionName().equals(x.getCompetitionName()))
- 03-23-2010, 06:34 AM #4
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Similar Threads
-
Stuck in sea
By programmer_007 in forum JDBCReplies: 1Last Post: 09-17-2009, 04:00 AM -
stuck on same syntax error....
By Moltisanti in forum New To JavaReplies: 2Last Post: 09-01-2009, 04:26 AM -
Im on my last lab!!!! And im stuck...:(
By clanboru15 in forum New To JavaReplies: 5Last Post: 03-13-2009, 01:44 AM -
really stuck now..
By shongo in forum Advanced JavaReplies: 2Last Post: 11-09-2008, 02:56 AM -
Stuck in need of help!
By Zombie_Leg! in forum New To JavaReplies: 1Last Post: 09-23-2008, 02:22 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks