Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need help about wildcard generic types in Java

I am learning generic programming in java. I saw these charts in Core Java (Edition 9):

? extends T

? super T

And I saw these charts in Introduction to Java Programming Comprehensive Version Tenth Edition:

Figure in the book

But I believe it should be this instead:

My Figure

Could someone tell me whether I am right?

like image 892
cmpltrtok Avatar asked Aug 30 '20 05:08

cmpltrtok


1 Answers

Yes, you are correct. The mistake is listed in the Errata for this edition (which might be useful for similar confirmations in the future):

Chapter 19

Page 749, Figure 19.6, change the last "A<B' subclass>" to "A<B' superclass>".

like image 119
Mark Peters Avatar answered Sep 29 '22 13:09

Mark Peters