Let's say I have a method m()
that takes an array of strings as an argument. Is there a way I can just declare this array in-line when I make the call, i.e. instead of
String[] strs = {"blah", "hey", "yo"};
m(strs);
Can I just replace this with one line, and avoid declaring a named variable that I'm never going to use?
m(new String[]{"blah", "hey", "yo"});