Results 1 to 2 of 2
  1. #1
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    157
    Rep Power
    5

    Default what are rule to overrid a method

    Hi
    what are rule to overrid a method
    interface first{
    public void print();
    public String print();
    }

    if i implemt the first then by the difference in the return type override may be correct but i shows complie time error

    please explain me

    thanks in advance

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    The return type is not part of the signature of a method. A method declaration cannot differ in only the return type (and/or access level). Besides, two method in the same class, with the same name, is called overloading (and you do that with varying parameter definitions), not overriding.

Similar Threads

  1. Disposable email addresse rule
    By angryboy in forum Suggestions & Feedback
    Replies: 0
    Last Post: 03-31-2009, 07:47 PM
  2. Identifier Naming Rule
    By udayadas in forum Advanced Java
    Replies: 1
    Last Post: 08-21-2008, 05:56 PM
  3. calculator java following pemdas rule
    By sassygirl_kea9@yahoo.com in forum New To Java
    Replies: 2
    Last Post: 07-10-2008, 04:15 AM
  4. New rule to PMD-ECLIPSE plugin
    By jai in forum Eclipse
    Replies: 1
    Last Post: 04-21-2008, 05:40 PM
  5. Java Rule engines
    By bluekswing in forum Advanced Java
    Replies: 0
    Last Post: 01-02-2008, 10:11 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
  •