Menu
gps garage
  • Home
  • Health
  • Nature
  • IT & Software
  • Science
  • Technology
  • Offers
  • Write for Us
    • Privacy Policy
    • Terms & Conditions
gps garage
Overloading in Java

Overloading in Java?

Posted on May 1, 2021May 1, 2021

Overloading in Java

When different methods have the same name but different signature is known as overloading in java. It means parameter have different number of inputs. So, overloading is defined as:

  • Same method name
  • Different argument types
  • May have different return types

Overloading in Java

For example, consider the following code. In this code add() method has string parameter in Calculator class (super class) and overload in the Addition class (child class). In the child class add() method has int parameter.

public class Calculator //super class

{

public void add(String name) //method with string parameter

{

………..

}}

public class Addition extends Calculator() //child class

{

public void add(int a) //overload add method with int parameter

{

………..

}

public static void main(String args[])

{

Addition object1 = new Addition()

object1.add(5);

}

}

 

Download JDK

Download JRE

 

Must Read – Java Code Editor

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Archives

  • March 2025
  • January 2025
  • December 2024
  • September 2022
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2025 GPS Garage | Powered by SuperbThemes