Question: I have a problem in Eclipse with writing an array:

```
public class nizovi {
    int[] anArray;
    anArray = new int[10];

}

```

Eclipse says: 

> 
> "Syntax error on token ";" ,, expected"
> 
> 
> 

As you can see, it looks perfectly fine. I don't know what is going on with it.

Answer: 
If you want to assign a value on class level, you must do it in one line:

```
public class nizovi {
    int[] anArray = new int[10];

}

```
I recomend you initialise your array in a constructor this way :

```
public class Nizovi {
    int[] anArray ;
    public Nizovi(){
        this.anArray = new int[10];
    }
}

```