☕ Java
Beginner
What is method overloading in Java?
Answer
Method overloading is defining multiple methods with the same name but different parameter lists (different number, type, or order of parameters) within the same class. Java determines which overloaded version to call at compile time based on the argument types — it is a form of compile-time (static) polymorphism. Example: add(int a, int b), add(double a, double b), and add(int a, int b, int c) are three valid overloads. The return type alone does not constitute overloading — two methods with the same name and parameters but different return types will not compile.