Originally posted by Pinkal Patel: 1. Basket b1 = new Basket<Fruit>(); // Tack any tupe of Object as input 2. Basket<Fruit> b2 = new Basket<Fruit>(); //Tack only Fruit Object as input
The primary benefit of generics is to provide compile time checking (strong typing) for collection elements. Your example reinforces this point.