Reputation: 7468
As per type erasure mechanism in Java generics, a method:
boolean add(E e);
..gets compiled to
boolean add(Object e);
But then how is type safety ensured? As add now takes Object, I can pass String, Integer, Employee etc as all are sub-types of Object.
Upvotes: 0
Views: 16