#bloch-effective-java-2ed #java #p119

Generics are implemented by erasure. This means that they enforce their type constraints only at compile time and discard (or erase) their element type information at runtime. By contrast, array types are reified, so they can enforce their type at runtime (e.g. if you try to store a String into an array of Long, you’ll get an ArrayStoreException).


Do you want to join discussion? Click here to log in or create user.