I have a situation in which I have to create a generic method that can accept List of child objects but not the parent class objects.
Say I have
class ClassA {}
which is getting extended by
class ClassB extends ClassA {}
class ClassC extends ClassA {}
executeMethod(List</* either ClassB or ClassC but not ClassA */>)
Can we achieve it using generics?