Which of the following statements are true?

Options
- Method overloading is done in super and sub classes.
- In method over riding two or more methods with same number but with different signatures
- In method overriding method return type can be same or different
- None of the above


CORRECT ANSWER : None of the above

Discussion Board
All are dumb

Ans 3 is correct. return type can be same or sub class of return type of the overridden method.

Narendra Babu, are private or protected return types?

Akash 10-18-2018 06:36 AM

Both option 1 & 3 are correct

because return type can be of more scope i.e if it is private in super class , it can be protected or public in subclass for overriden method

Narendra Babu 06-25-2014 10:46 PM

Answer for this question is option 1

Yes i do agree with u Harikrishna.
we can overload methods in subclass and only the non-static methods can be overloaded because inheritance is valid/applicable only for non-static members & static members are not inherited.

shruti 09-5-2013 03:50 AM

Overloading point found mistake

Why can't we overload method in subclass?

http://docs.oracle.com/javase/tutorial/java/IandI/override.html

According to SUN tutorial we can overload a super class inherited method in subclass.

I believe the answer for this question is Opetion #1:

Please give explanation for ur answer.

Harikrishna 08-11-2013 02:43 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement