Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are covariant return types?

covariant Return types
0
Posted

What are covariant return types?

0

Return types of overriding methods where the supertype method’s return type is a supertype of the subtype method’s return type.

0

Simply put, covariant return types allow derived classes to change the return type of an overriden method to return a type that is a subtype of the return type of the base class method. C++ allows this, currently Java does not.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123