Is there any syntax in Java to initialize a list of variables for the corresponding objects in an array?
String hello, world; String[] array = {"hello", "world"};
I think I remember this type of convenient syntax from Matlab, but I did not notice a way to achieve this in Java. Such syntax will help me organize my code. In particular, I would like to pass an array of objects in one argument to the function instead of each of the array members in several arguments, and then start the code for the method by declaring variables in the method area for named access to the elements of the array, For example :.
String[] array = {"hello", "world"}; method(array); void method(array){ String {hello, world} = array;
Thanks for the advice. -Daniel
source share