I have a problem with the following example:
public static void main(String[] args) {
int[] test1DArray = returnArray();
int[][] test2DArray = new int[][] {
new int[]= returnArray(),
new int[] {1, 2 ,3}
}
private static int[] returnArray() {
int[] a = {1, 2, 3};
return a;
}
I am looking for a way to create a two-dimensional array and the second dimension is the array returned by the method. I do not understand why this does not work, since the error I get in Eclipse is
The left side of the job must be variable
From my point of view, I create a new int array and assign it a return value. Filling a second array of measurements right away like this
new int[] {1, 2 ,3}
works like a charm and I'm looking for something similar with an array that was returning to me from returnArray()
Any help is greatly appreciated.
R/
source
share