Skip to main content

Blog Archive for alexfromsun during May 2011

Generics doesn't work well with arrays. Everybody knows that you can't create a generified array, but not many people really know what it was done this way. A nice article from Brian Goetz helped me to understand the problem when I studied the new features of JDK 5. The arrays in java are covariant when generics are not. The following code clearly shows it: String stringArray[] = new String[1...