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
What is the purpose of javac exe?
Why parameters should be passed by reference?
Does treeset use compareto?
How do you implement singleton class?
What are the states of thread in java?
What are the disadvantages of using inner classes?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread
What is basic syntax?
What is var keyword ?
What is the tradeoff between using an unordered array versus an ordered array?
What is the role of the java.rmi.naming class?
When does a class need a virtual destructor?
What is the purpose of the system class in java?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
Explain the difference between abstraction and encapsulation.