Declaring and Initializing a string array in different lines?
in
Programming Questions
•
2 months ago
How can I declare and initialize an array, whether 1d or 2d, in different lines without having to use a for loop with continuous iterations? It may be easier when comparing integers, but when I want the elements to be strings, it is more of a problem.. On a single line, it is easy, eg.
String [] var = {"hello", "bye"};
But the same doesn't go for
String [] var = new String [2];
var[] =
{"hello", "bye"};
Please help...
1