---
title: "Comment by Niraj Kumar Gangale on \"Java #6 - Array (Part-1)\" | Hashnode"
description: "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 diffe"
url: "https://hashnode.com/posts/java-6-array-part-1/630093da74730d13020f163e/comment/6334235afa20fa4bc8e51799"
---

[Discussion](https://hashnode.com/posts/java-6-array-part-1/630093da74730d13020f163e)

Comment [Java #6 - Array (Part-1)](https://hashnode.com/posts/java-6-array-part-1/630093da74730d13020f163e)

[Niraj Kumar Gangale](https://hashnode.com/@iamnirajdotcom)

[Sep 28, 2022](https://hashnode.com/posts/java-6-array-part-1/630093da74730d13020f163e/comment/6334235afa20fa4bc8e51799)

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](https://hashnode.com/posts/java-6-array-part-1/630093da74730d13020f163e/comment/Link)

> 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?
