Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    jomypgeorge is offline Member
    Join Date
    May 2010
    Posts
    90
    Rep Power
    0

    Default

    return type is not used for method overloading.
    for method overloading two methods should have some change in parameter list.

    consider this

    class x
    {
    void getdata()
    {
    int x =1;
    }
    int getdata() //-------------- line number 7
    {
    int x =1;
    return x;
    }
    }

    when compile we get an error like this

    x.java:7: getdata() is already defined in x
    int getdata()
    ^

    compiler consider both methods as same

  2. #22
    lala is offline Member
    Join Date
    Oct 2010
    Posts
    80
    Rep Power
    0

    Default Method Overloading Verification‏

    Thank you jomypgeorge, & everyone who helped me to understand the Overload method concept.

    As always I am deeply appreciative.
    lala

  3. #23
    jomypgeorge is offline Member
    Join Date
    May 2010
    Posts
    90
    Rep Power
    0

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Overloading qn
    By diskhub in forum New To Java
    Replies: 18
    Last Post: 06-07-2010, 05:19 PM
  2. method overloading and arrays.
    By glopez09 in forum New To Java
    Replies: 5
    Last Post: 12-08-2009, 03:02 PM
  3. Replies: 0
    Last Post: 04-17-2008, 07:43 PM
  4. Overloading?
    By padutch2 in forum New To Java
    Replies: 2
    Last Post: 12-31-2007, 03:26 AM
  5. Method/Operator Overloading
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-01-2007, 08:33 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
  •