ClassCast error: Java 7 vs Java 8
问题 Is this a bug or feature? The following code runs fine in Java 7 but throws an exception in Java 8: The last command throws a ClassCast exception in Java8, all the "equivalent" commands above work the same way. The problem, I think, is that in Java 8, the compiler decides to use String.value(char[]) on the last line instead of String.value(Object) as in Java 7. I would think this should behave the same way for backward compatibility. Am I missing something? Note: As Marko suggested this is