Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
covariant returns
Satish Ray
Greenhorn
Posts: 16
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Can anybody explain me what exactly are covariant returns?
Petrus Pelser
Ranch Hand
Posts: 132
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Covariant returns are when you return a subtype of the return type defined by the method you are overridding.
E.g
class A { A method() {} } class B extends A { B method() {} }
This is a legal override as the overridden method returns a subtype of the original method's return type.
Jim Yingst
Wanderer
Posts: 18671
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Note also that covariant returns are legal in JDK 5 and later, but not in earlier versions.
"I'm not back." - Bill Harding,
Twister
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
including covariant return ?
covariant returns
query related overriding.
Need help for method selection
Covariant Returns
More...