Strange situation - below is the code:
ArrayList listArr = new ArrayList<>(); Object[] obj = new Object[]{\"str\", listArr}; String st
This is because if you try to cast Integer to String you will get ClassCastException at runtime. But there will be no ClassCastException here:
ArrayList listArr = new ArrayList<>(); ArrayList list = (ArrayList) obj[1];