Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

operator trouble

 
Candy Bortniker
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a "The operator > is undefined for the argument type(s) int, String" error on the if statements using vals.getMinimum and vals.getMaximum. Total is an int. getMinimum and getMaximum return ints. What else do I need to do to make this work?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the error message, it really looks like your compiler is convinced that getMaximum() and getMinimum() return ints. Double check this four or five more times. Try deleting all your .class files (not the .java files) to ensure that the compiler is recompiling everything it needs to. Make sure your class path isn't pointing to any other directories that have an old/alternate version of the class that has getMaximum() in it.
 
Candy Bortniker
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, now I'm more confused. I want getMinimum()/getMaximum() to return ints. vals is a Values object is that what is causing the problem? If not, what would be the problem with total and getMinimum()/getMaximum() both being ints?
 
Howard Kushner
author
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Candy,
Presuming that total is an int as you claim, what is the Values type? Can you share the class definition with us?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the error message, it really looks like your compiler is convinced that getMaximum() and getMinimum() return ints.
Oops, I misspoke here. I mean to say the error message indicates the compiler thinks getMaximum() and getMinimum() return Strings. Not the ints which you want (and which would also make the compiler happy.)
And Howard is correct - check the type of total too. Something is a String when it should be an int.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The errormessage says, that the second parameter is a String.
You needn't proof this.
Allways read errormessages carefully.
Most people close their eyes when an error occurs.
(And it's always more easy to find the errors from the others.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic