LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03:59 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

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, 04: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, 04: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



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 12:46 AM
Other install methods? Icon Mandriva 7 11-01-2003 04:14 AM
Boot methods Nasty Linux - Newbie 1 10-11-2003 04:29 PM
search methods odious1 Linux - Newbie 4 07-10-2003 11:11 PM
Blackdown, Java.com what's the difference? MasterC General 4 06-03-2003 08:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:05 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
Open Source Consulting | Domain Registration