Question: Why when I try to initialize the array like that it gives me an error

```
package practicejava;

class Test {

    public static void main(String[] args) {

        int[] array;
        array ={};

    }
}

```

Why the following code shows me an error?

Answer: 
Change as follow:

```
int[] array;
array = new int[]{};

```

Your current way of assigning the array is invalid.
you have to declare array size in array like as below

```
   array  = new int[5];

```