How is the syntax in Java for GenericExample<ItemType (extends or equal to) Object>?
Thanks, Adam.
Update:
Thanks for all your replies. The answers here are more related to the use of the generics in code, I would like to discuss the deceleration implementation, for example:
class GenericExample<ItemType (extends or equal to) ParentType> {
}
class Inherited<ParentType> extends GenericExample<ParentType> {
/* The type parameter in this class does not compile.
I would like to find a work around to make something like this to work.
I would like to have ParentType=JComponent , and thus to specify that the
Inherited class uses JComponent for needed flexibility*/
}
I hope this makes more sense...
Adam.
You already got it:
GenericExample<ItemType extends MyObject>
A first guide on generics can be found here: http://download.oracle.com/javase/1.5.0/docs/guide/language/generics.html
GenericExample<T extends Object>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With