Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

need help with compareTo(Object o)

  Asked By: Madeline    Date: Nov 06    Category: Java    Views: 980

i need help understanding compareTo(Object o) method of interface Comparable.

Does anyone know how to use this method to compare two String objects that are
stored in a
public static final String [] bla = { "a","b", "c", "d", "e"};

hit me back ASAP please its really important......................



2 Answers Found

Answer #1    Answered By: Kerry Wright     Answered On: Nov 06

perhaps something like:

public static  final String [] bla = { "a","b", "c", "d", "e"};

public boolean itsThere(String str)
for(int i=0; i<bla.length; i++)
return true;
return false;

Answer #2    Answered By: Miriam Green     Answered On: Nov 06

but i really anted to see something like "x.compareTo(y)" and how it
can be used to override the compareTo method  for class that
implements Comparable?

Didn't find what you were looking for? Find more on need help with compareTo(Object o) Or get search suggestion and latest updates.