Advantages of Generics (Cont.)
Programs that uses generics have many benefits over non-generic code (cont.):
Type safety (cont.):
How can generics help to solve this problem?
At the time of defining ArrayList, we can specify that this list can take only String objects.