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

Comparable Interface

 
Asha Pathik
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've written this program to override the compareTo() method of Comparable interface.
It compile and runs fine if I change the line1 to return this.compareTo(i1); but when I write it the way it is in the program it gives compile time error saying compareTo<java.lang.Integer> in java. lang.Integer cannot be applied to <temp21>. Could anyone plz explain this error and the reason for why we cannot do it this way?

Thanks
 
Asha Pathik
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the answer. Sorry for asking such silly question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic