• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Question about generic overriding. Blow up brain.

 
Ranch Hand
Posts: 472
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question not from mock test. It arise when i read Mala Gupta book and think about how exam may trick me.
Why MapLegendGeneric cosider that it corectly override MyMap??? try code yourself, pay note that MapLegendGeneric<V, K> change position of <K, V> when implements MyMap<K, V>
Why MapLegendGeneric cosider that it corectly override (note using @Override to check!) MyMap???

also just for test i make some changes:

 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried it myself, but I don't think that the order of type parameters in



is significant. In other words I think that the two V's are matched and the two K's are matched. A test of this hypothesis:



should produce some error messages.
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!