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

What are local variables?

589


How do you declare an array that will hold more than 64KB of data?

634


How to create packages in java?

521


What will be the output of round(3.7) and ceil(3.7)?

671


What is the file extension for java?

601






What java ide should I use?

559


What is a java object and java application?

572


Why should I use abstract class?

562


What is meant by method?

575


Which of the classes will have more memory allocated?

532


What is the maximum size of array in java?

510


Is array size fixed in java?

532


Can we call a non-static method from inside a static method?

554


What things should be kept in mind while creating your own exceptions in java?

621


Can we convert list to set in java?

508