3 Replies Latest reply: Apr 30, 2007 4:54 AM by 807606 RSS

    Comparing Object and String

    807606
      I have a method called getKey() which returns and Object and I want to use it to retrieve the Key of a and then compare it with a string called names[0].

      The code I have tried to use is:
      if (a.getKey() != names[0])
      However I know this is wrong as it doesn't work and it is comparing two different types, How would I convert the Object to a string to compare the two values?