Results 1 to 2 of 2
  1. #1
    Gilgamesh is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default String vs Object

    Java Code:
    int cmp = word.compareToIgnoreCase(AlphabetizedVector.get(mid));
    (the 'word' is a String)
    (mid is an int representing the mid of the Vector)

    The method compareToIgnoreCase(String) in the type String is not applicable for the arguments (Object)

    whats the problem? what should I do?
    Last edited by Gilgamesh; 11-28-2007 at 10:29 PM.

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    This method takes an argument type of String.
    compareToIgnoreCase(String str)
    AlphabetizedVector.get(mid) returns type Object.
    Try casting the return value to type String:
    Java Code:

Similar Threads

  1. Converting object to string
    By Preethi in forum New To Java
    Replies: 4
    Last Post: 06-14-2008, 04:29 AM
  2. Replies: 1
    Last Post: 04-09-2008, 03:15 AM
  3. Replies: 4
    Last Post: 03-25-2008, 01:16 PM
  4. Object from String (calling method dynamically)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-16-2008, 10:22 PM
  5. Object from String
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-16-2008, 10:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts