File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Comparable Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Comparable Interface" Watch "Comparable Interface" New topic
Author

Comparable Interface

Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
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


SCJP 1.5
Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
I got the answer. Sorry for asking such silly question.
 
Don't get me started about those stupid light bulbs.
 
subject: Comparable Interface
 
Similar Threads
Collections
sorting..
List.toArray() method
Simple J2SE 5.0 Tiger Notes
Collections.binarySearch Question