• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compare Function  RSS feed

 
William Kohus
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to compare two ID's and print a message if the ID's are the same. Having issues calling the method.




Here is the whole program.

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you think the JVM knows how to decide if two SKU instances are equal to each other if you don't tell it ?

Also, once you've fixed that, in your CompareTo method you're testing if an instance of SKU is equal to its own id. I don't think that's what you intended.

And thirdly, you never call your CompareTo method.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fourth, this has nothing to do with Swing / AWT / SWT / JFace. Moving to Beginning Java.
 
Ryan Sykes
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, you should follow naming conventions and call your method compareTo() not CompareTo ...which would be confused as a Class name.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!