p
Both code are same except only one(in bold) line I have added into 2nd code.
Why the first code compiles? Why in print statement it takes list.get(0) without cast?
But if I add
String s=list.get(0), it gives me compiler error. Because "List list" is a non-generic, so the things comes out are Object type.
Now my question is , who is doing cast in print statement? Or I am missing something? can anyone please explain?