Lesson 20 of 34
Method OverloadingMethod Overloading
7 min 30 XP
ஒரே பெயரில் பல methods எழுதலாம், parameters வேறுபட்டால் போதும் (எண்ணிக்கை அல்லது type). Java அழைப்பைப் பார்த்து சரியானதைத் தேர்ந்தெடுக்கும். இது compile-time polymorphism.
Several methods can share a name as long as their parameters differ in number or type. Java picks the right one from the call. This is compile-time polymorphism, a classic interview term.
Example: edit me and press Run
Press Run to see the result here.Return type மட்டும் வேறுபட்டால் overloading ஆகாது, compile error வரும்.
Changing only the return type is not overloading; it's a compile error.