| Author |
Why is my type unexpected? required variable found value
|
Tiffany Walker
Greenhorn
Joined: Oct 14, 2011
Posts: 10
|
|
I'm trying to sort an array of object by the name of the Artist. But I keep getting an error message. Why am I getting this message?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
Showing us the exact wording of the message might be helpful.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Tiffany Walker
Greenhorn
Joined: Oct 14, 2011
Posts: 10
|
|
error: unexpected type lines 76 and 77 for .getArtist Required Variable Found Value
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
You are using the getArtist() method to the left of a =. That won’t work. What are you trying to do? Copy the artist from one object to another?
foo.setFoo(foooooo.getFoo());
|
 |
Tiffany Walker
Greenhorn
Joined: Oct 14, 2011
Posts: 10
|
|
Thanks guys I have the fixed, but now I'm getting a bad operand types for operator <. first String. second string.
I get want the error means, so I'm assuming that I can't use this operator to sort my array of objects. Is there some other way for me to sort this array out. I need to sort the array by the Artist name.
Here's my new code
error occurs for line 86
|
 |
Tiffany Walker
Greenhorn
Joined: Oct 14, 2011
Posts: 10
|
|
I apologize the lines are different here. The error occurs at line 81
|
 |
Tiffany Walker
Greenhorn
Joined: Oct 14, 2011
Posts: 10
|
|
Never mind folks,
someone suggested the compareTo() method at that works just fine for me.
|
 |
 |
|
|
subject: Why is my type unexpected? required variable found value
|
|
|