I want to ask a question. when does type checking happen in Array at Compile time or the Runtime?
https://www.baeldung.com/java-generic-array
An important difference between arrays and generics is how they enforce type checking. Specifically, arrays store and check type information at runtime.
Then, this should work fine.
int[] firstArray = {"hello", "hello2"};
But, this gives Compile time error. Why?