this is my first question I ask here so I might do some things wrong.
I wish to declare a variable which I know is of a class which implements an interface.
private <T extends Executable> T algorithm;
This was my attempt to achieve the goal
You don't have to use generics for that. The following will work for any sub-class / implementation of Executable:
private Executable algorithm;
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