would someone help me understand this behavior of Java?
I found that running
Object[] objArray = {"A", "B"};
String[] strArray = (String[]) objArray;
throws a ClassCastException (so far, so good). However,
String[] strArray = {"A", "B"};
Object[] objArray = strArray;
String[] castStrArray = (String[]) objArray;
does not. I have trouble understanding this (I do not see in which ways the 'objArray' in both versions are different). Could someone help me understand the underlying concept?
Best regards!