aspose file tools*
The moose likes Beginning Java and the fly likes Why is my type unexpected? required variable found value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why is my type unexpected? required variable found value" Watch "Why is my type unexpected? required variable found value" New topic
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: 60046
    
  65

Showing us the exact wording of the message might be helpful.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 36453
    
  15
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is my type unexpected? required variable found value
 
Similar Threads
Exception in Thread-Inventory Program
My loop isn't working
Arrays are confusing
Car Inventory Problems
Java help.