Java泛型:什么<?(Java Generics: what does extends Interface >> mean?)
继上一篇文章之后,我希望有人可以帮助澄清/确认我对以下java泛型语句的理解,并提供一些输入,说明最终的含义:
如果:
Class<abc> className = x
表示将类型为
abc
x
分配给Class
变量className
和:
Class<? extends IAbc> className = x
意味着将实现接口
IAbc
x
分配给Class
变量className
什么:
Class<? extends IAbc<?>> className = x
意思?
Further to a previous post I'm hope someone can help clarify/confirm my understanding of the following java generics statements, and offer some input as to what the final one means:
If:
Class<abc> className = x
means to assign
x
of typeabc
toClass
variableclassName
And:
Class<? extends IAbc> className = x
means to assigns
x
which implements interfaceIAbc
toClass
variableclassName
What does:
Class<? extends IAbc<?>> className = x
mean?
原文:https://stackoverflow.com/questions/13180855
更新时间:2023-07-31 10:07