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


Please Help Members By Posting Answers For Below Questions

Explain wait() method of object class ?

636


What is the difference between hashmap and hashtable? What is an interface?

508


Explain differences between collection api and stream api?

612


Can we extend singleton class in java?

546


What is arguments in java?

523






What is the difference between stringbuffer and stringbuilder?

577


Can we execute a program without main?

541


What is anagram word?

523


can I implement my own start() method? : Java thread

555


Explain about the performance aspects of core java?

555


What is difference between iterator and enumeration in java?

527


What is multi level inheritance in java?

560


What is the size of a string in java?

547


Why is String immutable?

624


What is the size of arraylist in java?

608