What is Co-Variant return type in method overriding?

Answer Posted / harini

If the parent class method return type is object then child
class method return type need not be object. We can take
its child classes also.
The co-varient return types of no. class are
Byte/short/integer/long/float/double.
ex:
object-----string ----valid
number-----integer----valid
string------object----invalid

Is This Answer Correct ?    18 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is overloading and overriding in java?

925


What are the disadvantages of using inner classes?

782


Why collection doesn’t extend cloneable and serializable interfaces?

887


Is passing by reference faster?

764


What is scope of a variable?

838


Does java arraylist maintain insertion order?

762


What is the purpose of extern variable?

769


Is java an ide?

731


Why we cannot override static method?

772


What access modifiers can be used for class ?

774


Write a program to show whether a graph is a tree or not using adjacency matrix.

852


Give example to differentiate between call by value and call by reference.

804


Is java code slower than native code?

780


What is floor in java?

817


Is string is a class in java?

707