Your initialization statement is wrong: you must add square brackets to declare an array (and here you can omit the new
keyword because you're declaring and initializing the variable at the same time):
int[] pos = { 0, 1, 2 };
In the onCreate
method, you can't omit the new
keyword because the variable was already declared, so you have to write:
pos = new int[] { 2, 1, 0 };
You can read the Oracle documentation and the Java Language Specs for more details.