0
Object[] o = new Object[3];  
String[] s = new String[3];

o = s; //compiles
o[0] = new Date();

List<Object> o2 = new ArrayList<>();
List<String> s2 = new ArrayList<>();

o2 = s2; //does not compile

I dont understand why the first block of code o=s; compiles correctly and the assignment of o2=s2; therefor is wrong.

user2048767
  • 135
  • 10

0 Answers0