What is Co-Variant return type in method overriding?



What is Co-Variant return type in method overriding?..

Answer / 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

More Core Java Interview Questions

What does 3 dots mean in java?

0 Answers  


What is an abstract class and what is it’s purpose?

0 Answers  


What are the differences between graph and tree?

0 Answers   Amazon,


Can we rethrow the same exception from catch handler?

0 Answers  


84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.

1 Answers  






What are assertions in java?

1 Answers   Impetus,


How to perform Singleton of the java class object on multi JVM?

2 Answers  


I want to persist data of objects for later use. What is the best approach to do so?

0 Answers  


what are the different non-access specifiers in java?

5 Answers  


what are the difference between Java and .Net?

5 Answers  


Write code of any action class?

0 Answers  


what is the difference b/w PUT and POST method to send data to the server

5 Answers   Mind Tree,


Categories