Method Overloading යනු එකම Class එකක එකම නමින් Method නැවත නැවත සෑදීමේ දී Method Overloading Concept එක භාවිතා කරයි. Parameters භාවිතයෙන් Method Overloading සිදු කල හැකිය. එකම Class එකක එකම නමින් Method කිහිපයක් Parameter Signature එක Use කර සෑදීම Method Overloading ලෙස හැදින් වේ. Parameter Signature යනු Parameter වෙනස් කිරීමෙන් හදුනා ගැනීමයි.

How to perform method overloading in java?
 

Overloading සිදු කිරීමට විවිධ ක්‍රම මෙන්න..

  • Parameters වෙනස් කරමින් Overloading කිරීම
  • Changing the data type of parameters.

Important Points

Method overloading is achieved by ether:
  • changing number of arguments.
  • changing the data type of arguments. 
It is not method overloading if we only change the return type of the methods. There must be difference in the number of parameters.

 

Copyright © 2022 All Right Reseved