Results 1 to 2 of 2
  1. #1
    cachi is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Help with signature matching

    Hi, I've never touched it.
    Is it possible to have two or more methods using signature matching having different return types?

    Thanks.

  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    No. Return types are not considered as part of the signature. And you cannot have two methods with the same signature. Here is the reason: Say I have two methods that return a status one as an int and one as a String. Both take the same params. Now which one am I calling?
    Java Code:
    myMethod("blabla");
    There is no way to tell as I'm not doing anything with the return type.

Similar Threads

  1. Replies: 0
    Last Post: 04-16-2008, 10:59 PM
  2. regular expressions and string matching
    By DennyLoi in forum New To Java
    Replies: 1
    Last Post: 11-16-2007, 10:15 AM

Posting Permissions

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