what is method overloading?

396 views
343 views

Published on

what is method overloading?

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
396
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

what is method overloading?

  1. 1. 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
  2. 2. Method Overloading SWALIH T swalihk321@gmail.com www.facebook/ swalih321 twitter.com/swalih321 in.linkedin.com/in/swalih321 9539353663
  3. 3. POLYMORPHISM • Polymorphism means more than one form, same object performing different operations according to the requirement. Types • Compile time: Overloading. • Run time: Overriding.
  4. 4. 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.
  5. 5. 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.
  6. 6. Method Overloading There are two ways to overload the method in java o By changing number of arguments o By changing the data type
  7. 7. o By changing number of arguments
  8. 8. o By changing the data type
  9. 9. 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.
  10. 10. 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
  11. 11. 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

×