To quote the JLS :
An array's length is not part of its type.
To initialize an array you should do :
public char[] language = new char[5];
Other solutions are
public char[] language = {0, 0, 0, 0, 0};
or
public char[] language;
language = new char[5];
In Java, the array declaration can't contain the size of the array; we only know the variable will contain an array of a specific type. To have an array initialized (and with a size) you have to initialize it either by using new
or by using a shortcut which allows to initialize and set values for an array at the same time.
Best way to have to check if an array has a specified size, is actually checking the size of the array yourself with something like if(array.length == 5)
.
Resources :
On the same topic :