Java static initialization problem

public static void main (String [] argv) {

    int i, j=3;
    Scanner input = new Scanner(System.in);
    i = input.nextInt();
    int[] arr = new int[]{i,j};
    System.out.println(arr[0]+" "+arr[1]);

}
shouldn"t the above programs initialize the value of arr [] when they read int [] {iMagnej} when compiling? I should not be able to compile because I is not initialized, why can I still compile and output the correct value? Is it possible that int [] arr = new int [] {iMagnej}; is also a dynamic initialization?

Mar.23,2021
Isn't the sentence

I = input.nextInt ();
equivalent to initialization?
if this sentence does not definitely report an initialization exception, this sentence means that the value of I is uncertain at compile time.


Java language specification find out:

), and may be assigned to variables of type Object. dynamically created by In the Java programming language, arrays are objects, are dynamically created ( All methods of class Object may be invoked on an array.

I is a local variable

Menu