• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why is my type unexpected? required variable found value

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Marshal
Posts: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Showing us the exact wording of the message might be helpful.
 
Tiffany Walker
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
error: unexpected type lines 76 and 77 for .getArtist Required Variable Found Value
 
Marshal
Posts: 71733
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize the lines are different here. The error occurs at line 81
 
Tiffany Walker
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind folks,

someone suggested the compareTo() method at that works just fine for me.
 
reply
    Bookmark Topic Watch Topic
  • New Topic