Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Method Overloading
SWALIH T
swalihk321@gmail.com
www.facebook/ swalih321
twitter.com/swalih321
in.linkedin.com/in/swalih321
9539353663
POLYMORPHISM
• Polymorphism means more than one
form, same object performing different
operations according to the requirement.
Types
• Compile time: Overloading.
• Run time: Overriding.
Method Overloading
• Method overloading means writing two are or
more methods in the same class by using same
method name, but passing the parameters is
different.
• Overloading is the practice of supplying more
than one definition for a given method name in
the same class. The compiler will automatically
select the most appropriate one based on the
arguments with which it is called.
Method Overloading
• Overloading is useful to add flexibility to a
method. In general, if you want to create a
method that adds two numbers then it only
take either integer, double, or float but by
overloading, you can add values of all data
types.
Method Overloading
There are two ways to overload the method in
java
o By changing number of arguments
o By changing the data type
o By changing number of arguments
o By changing the data type
Advantages of method overloading
• It allows you to use the same name for a group
of methods that basically have the same purpose.
• It provides an easy way to handle default
parameter value.
• Assume that a method has one required
parameter and two optional parameters. Three
overloaded forms of this method can be defined.
It can accept one, two or three parameters.
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

what is method overloading?

  • 2.
    Disclaimer: This presentationis prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3.
    Method Overloading SWALIH T swalihk321@gmail.com www.facebook/swalih321 twitter.com/swalih321 in.linkedin.com/in/swalih321 9539353663
  • 4.
    POLYMORPHISM • Polymorphism meansmore than one form, same object performing different operations according to the requirement. Types • Compile time: Overloading. • Run time: Overriding.
  • 5.
    Method Overloading • Methodoverloading means writing two are or more methods in the same class by using same method name, but passing the parameters is different. • Overloading is the practice of supplying more than one definition for a given method name in the same class. The compiler will automatically select the most appropriate one based on the arguments with which it is called.
  • 6.
    Method Overloading • Overloadingis useful to add flexibility to a method. In general, if you want to create a method that adds two numbers then it only take either integer, double, or float but by overloading, you can add values of all data types.
  • 7.
    Method Overloading There aretwo ways to overload the method in java o By changing number of arguments o By changing the data type
  • 8.
    o By changingnumber of arguments
  • 9.
    o By changingthe data type
  • 10.
    Advantages of methodoverloading • It allows you to use the same name for a group of methods that basically have the same purpose. • It provides an easy way to handle default parameter value. • Assume that a method has one required parameter and two optional parameters. Three overloaded forms of this method can be defined. It can accept one, two or three parameters.
  • 11.
    If this presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 12.
    Contact Us Emarald Mall(Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com