LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 09-19-2004, 04:59 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 704

Rep: Reputation: 30
difference between Java compare and compareTo methods


Does anybody know the differences between Java compare method (implements Comparator interface) and Java compareTo method (implements interface Comparable)?
The only obvious difference, which i have understood, is that that "compare" uses 2 arguments, while "compareTo" uses 1 argument.
 
Old 09-19-2004, 05:03 AM   #2
mirradric
Member
 
Registered: May 2004
Location: Singapore
Distribution: Debian woody and debian sarge
Posts: 188

Rep: Reputation: 31
precisely.
A comparable is an object which knows can can compare itself with other objects.
A comparator compares two other objects which need not know how to compare themselves with other objects.
 
Old 09-19-2004, 05:08 AM   #3
mirradric
Member
 
Registered: May 2004
Location: Singapore
Distribution: Debian woody and debian sarge
Posts: 188

Rep: Reputation: 31
or should i say an instance of
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -- methods -- please help Laptop2250 Programming 2 12-13-2003 01:46 AM
Other install methods? Icon Mandriva 7 11-01-2003 05:14 AM
Boot methods Nasty Linux - Newbie 1 10-11-2003 05:29 PM
search methods odious1 Linux - Newbie 4 07-11-2003 12:11 AM
Blackdown, Java.com what's the difference? MasterC General 4 06-03-2003 09:30 PM


All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration