Can we assign 2-D array into 1-D array?

class Array23
{
public static void main(String[] args)
{
int[][] a={{5,4,3},{1,2}};
int[] b={10,20};
b=a;
for(int x:b)
System.out.println(x);
}
}
/*
Output:- CE[incompatible types]
Explanation:- Whenever we are trying to assign one array to another array, types & dimension
is matched but sizes are not required to match.
*/

0 comments: