Can we declare an array in one line?

Asked 2 years ago, Updated 2 years ago, 41 views

String[] strs = {"blah", "hey", "yo"};
m(strs);

The above code delivers the String list to the m()method, but I don't want to declare an array of strings, so can I make this code one line?

java array

2022-09-21 20:12

1 Answers

m(new String[]{"blah", "hey", "yo"});


2022-09-21 20:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.