As the Jon's answer of this post has said, if compiler allows this cast (shown below), to add some other objects later can be a bad thing for program.
ArrayList<String> temList = new ArrayList<String>();
ArrayList<Object> obList = (ArrayList<Object>)temList;//compile error
//obList.add(1); --bad
But what confuses me is why in the same situation, array has the different behaviours.
String[] strings = new String[10];
Object[] temp = (Object[])strings;//nothing happens
So could anyone explain what is the difference here and why java make such design? Thanks.
Edit: one similar question