Polymorph Is M
Polymorph Is M
How does the compiler differentiate between overloaded methods at compile time?
Java Concept Of The Day
Can you overload methods by altering only the access modifiers (e.g., public vs
private)?
Java Concept Of The Day
What happens when you call an overloaded method with null when multiple candidates
match?
Scientech Easy
Given void msg(Object), void msg(String), void msg(Integer), what does msg(null)
invoke?
Scientech Easy
Can you overload methods using primitive and their wrapper types interchangeably?
Scientech Easy
How does Java promote numeric types in overloaded methods (e.g., byte→short→int)?
Scientech Easy
What will be the output of calling m1(byte b) when overloads exist for short, int,
Object, and String?
Scientech Easy
Can you overload methods by changing only generic type parameters (type erasure
pitfalls)?
DigitalOcean
Can you override a method’s return type covariantly? Since which Java version?
Java Concept Of The Day
How does overriding interact with checked vs unchecked exceptions (throws clause)?
Java Concept Of The Day
When both overloading and overriding apply, how does Java choose which method to
call?
Medium
Can you override the equals() and hashCode() methods from Object?
Java Made So Easy
---
1. **Can you overload methods with the same name but different return types?**
2. **What happens if you pass `null` to an overloaded method with `String` and
`Object` parameters?**
3. **Does Java allow overloading based on `varargs` (e.g., `method(int... x)` vs.
`method(int x)`)?**
4. **Which method is called: `method(int)` or `method(double)` if you pass `5`?**
5. **Can you overload a static method?**
6. **What is type promotion in overloading? Explain with an example.**
7. **Why does `method(Integer)` get called instead of `method(int)` for
`method(10)`?**
8. **Can you overload `main()` in Java?**
9. **What happens if two overloaded methods are equally specific (e.g.,
`method(int, float)` and `method(float, int)`)?**
10. **Does overloading work with inheritance (e.g., subclass adding overloaded
methods)?**
11. **Can you overload a method by changing the order of parameters?**
12. **Why does `method(null)` cause ambiguity between `method(String s)` and
`method(Integer i)`?**
13. **Can you overload methods in the same class with `final` parameters?**
14. **What happens if you overload a method with `int` and `long` and pass a
`byte`?**
15. **Does Java support operator overloading (e.g., `+` for `String`)?**
16. **Can you overload methods with generic types (e.g., `method(List<String>)` vs.
`method(List<Integer>)`)?**
17. **How does autoboxing/unboxing affect overloading?**
18. **Can you overload a method with a subclass parameter (e.g., `method(Animal)`
vs. `method(Dog)`)?**
19. **Why can’t you overload methods by only changing the exception thrown?**
20. **What happens if you overload a method with `Object...` and `String...`
parameters?**
---
---