Before my onCreate()
method I can easily declare and initialise data types like int
with the code
int number = 2;
however if I want to do this with an array, using code such as
float[] array = new float[2];
array[0] = 1;
the second line gives me an error. Why is this? Is there a way of initialising this array before the onCreate()
method like I can do with other data types?