There are 2 methods in a class. Both have the same method
signature except for return types. Is this overloading or
overriding or what is it?
Answer Posted / shamsherabanu
It is not overloading because overloading must have different parameters, no matter what ever may be the return type is.
And for overriding inheritance should be used between 2 classes.
so it is neither overriding nor overloading.
It just show compilation error as method is already defined in
same class
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
How does map works in java?
Differences between external iteration and internal iteration?
Why lambda expression is used in java?
5 Coding best practices you learned in java?
What is scope & storage allocation of static, local and register variables? Explain with an example.
What is a qualifier in a sentence?
What are different types of encoding?
Which variables are stored in stack?
What are different types of expressions?
What is supplier in java?
Is integer passed by reference in java?
Garbage collection in java?
What's the purpose of using break in each case of switch statement?
Why hashset is used in java?
How to compare strings in java?