Results 1 to 4 of 4

Thread: What is method overriding and method overloading in java

  1. #1
    Join Date
    May 2008
    Posts
    69

    What is method overriding and method overloading in java

    Hi All,

    I am the I.T student . Current year of my course includes the JAVA. It is not very difficult me to understand the JAVA concept. But in some topics of JAVA I am getting confused.
    One of them is concept of method method overriding and method overloading.I am not able to differentiate what is different in method overriding than method overloading.

    Please help me you aware about this concept..

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is method overriding and method overloading in java

    I was also getting confused on the concept of method overriding and method overloading in java.Below information will solve your problem.

    Method overloading:
    If a method in a class has the same method name along with different number and type of arguments with the previous existence.This type of concept is called as Method overloading

    method overloading.
    Method Overridding: If a method in the class has the same name along with same number and type of arguments,without any previous existence.This type of concept is called as Method Overridding

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: What is method overriding and method overloading in java

    Please refer to the below syntax of overriding :

    //Below is syntax of function
    function test1_func()
    {

    }

    //Below is syntax of method overriding

    Class JJ
    {
    Test1_method(string a, string b)
    {
    a="XYZ";
    }
    }
    class MM : JJ
    {
    Test1_method(string a, string b)
    {
    a = "ABC";
    }
    }
    //Here override the functionality of the method which is
    available in Base Class.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: What is method overriding and method overloading in java

    Below is the difference which is I know:

    1. Overloading: In the method overloading declaration as well as definition are in the same class

    2. Overriding:In the method overriding declaration is done at parent class on other hand definition is define in child class.

    3. Overloading: Any code mistake we make in defining overloading code will be identified at compile time .

    4. Overriding: Any code mistake we make in defining overriding code will be identified detected at run time.

Similar Threads

  1. Method overriding versus method hiding in C#
    By ^MALARVIZHI^ in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 06:25 AM
  2. Method overloading c#.net
    By raju_srk in forum Software Development
    Replies: 1
    Last Post: 22-11-2010, 07:00 PM
  3. Abstract class method overloading problem
    By ISAIAH in forum Software Development
    Replies: 5
    Last Post: 16-01-2010, 10:18 AM
  4. Is it possible to call destroy() method within init() Method?
    By Level8 in forum Software Development
    Replies: 3
    Last Post: 10-12-2009, 08:36 AM
  5. Java: How can I call one method in another method?
    By biohazard 76 in forum Software Development
    Replies: 3
    Last Post: 16-07-2009, 07:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,755,331.31334 seconds with 17 queries