You can pass any collection that is of type Bike or any super type of Bike. i.e. Vehicle. and you can add elements into it. So Even if you pass a list of bikes or list of vehicles, you will still be able to add a Bike into it. But you cannot add a Car into the collection because our method parameter declaration allows only a list of bikes or list of supertype of Bike, i.e. Vehicle.
This is the scenario so ? extends doesn’t allow you to add into collection. But there is also a workaround for this. We can also pass a subtype collection and still be able to add into collection. We have to use the super keyword along with wildcard operator
From novice to tech pro — start learning today.