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.
Hey, I am trying to implement a code which requires a long list of elements in an array, maybe 300 or above... But each time I make some changes, I have to change the number of times a loop is to run since I am increasing the number of elements. Is there a function or some automatic way to make the program change the integer value by itself if I simply insert a variable in its place? Since counting upto 300 and beyond can be quite painstaking...
For example, take this array.
String[] var = {
"Hello","Bye"};
I know that there are two elements in this... If I didn't, then how could I make the application figure it out on it's own?