I'm looking for a way to give a java array a value directly, outside of its declaration, for example
/*this works*/
int a[] = {1,2,3};
/*this doesn't*/
a = {1,2,3};
the motivation is so that a method with an array as an argument can be used like this
public void f(int a[]) {
/*do stuff*/
}
f({1,2,3});
instead of
int a[] = {1,2,3};
f(a);