The problem is that when you create an array using an initializer, the compiler needs to ensure all elements from the initializer are of the same provided type by checking the type of the element against the provided type.
That said, you always need to provide the type information when initializing an array. Otherwise, the compiler doesn't know how to verify if the array initialization is valid, thus giving an illegal initializer error.
There's no problem assigning an array to an object. For example, you can do the following:
int[] arr = {1,2};
Object obj = arr;
The following code won't compile:
Object obj = {1,2};
Because you didn't explicitly provide the type of the element that the compiler needs to verify the values in the initializer against. And this is required for array initialization in Java.
The following code will compile:
Object[] obj = {1,2};
Because the type of the element was provided(i.e.,Object) and the compiler will check the type of 1, 2 against the type Object(which succeeds since Integer is subtype of Object).