Lesson 20 of 34
Method Overloading
7 min 30 XP
Parameters ची संख्या किंवा type वेगळा असेल तर अनेक methods एकच नाव वापरू शकतात. Java call पाहून योग्य method निवडते. याला compile-time polymorphism म्हणतात, interview मधला एक क्लासिक शब्द.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.फक्त return type बदलणे म्हणजे overloading नाही; तो compile error आहे.