why use generic in real life code example
Example 1: why use generic in real life
List list = new ArrayList();
list.add("hello");
String s = list.get(0); // no cast
Example 2: why use generic in real life
List list = new ArrayList();
list.add("hello");
String s = (String) list.get(0);