Initialize Array like this:
public Object[] settings = new Object[]{true, true, false, 1};
However, you cannot have arrays and values in the same dimension, because every element in a dimension must of the same type. (Strictly array '{}'
OR Object
in our case)
new Object[]{true, true, false, 1, {true, false} }; //<--- Illegal initializer
Instead just use several dimensions and group values in arrays:
public Object[][] settings = new Object[][]{{true, true}, {false, 1, 3}};
Either use ArrayList
or LinkedList
where it is possible to create any array you like.
Update
In fact it is possible to mix elements like this:
new Object[]{true, false, 1, new Object[]{true, false} };
{true, true, true, true}
is not valid Java syntax, except for innew something[] {true, true, true, true}
orsomething[] something = {true, true, true, true}
– Meistersinger