Please clarify as how line 2 and line 3 works whereas line 1 gives compiler error.
Originally posted by Noam Wolf:
you're passing o2 to ex1 which tries to add an object to o2. Remember a very important thing about extends: You can NOT add/manipulate a generic type that has extends in it! That's why line 1 is not compiling.
AS POSTED BY NOAM
1 is not compiling because you are saying param1 should be of type
List<X> where X is a runtime type (the ? is a placeholder which is
filled in by X at runtime). Param2 is an object. Since the compiler
cannot confirm that argument2 (of type object) is of type X, it breaks
Answer was given to me by Uber Java Engineer @ google...