What is method overloading in Java?
Why Interviewers Ask This
Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for Java development. It reveals whether you understand the building blocks that more complex concepts rely on.
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.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Java project, I used this when...' immediately makes your answer more credible and memorable.