0

I have two array a[] and b[] but i want to transfer the contents into two dimensional array c[][] is that possible......... Please help me

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by JamesCherrill
0

A "two dimensional array" in Java is really just an array of arrays, so if you have
int[][]c = new int[2][5];
then c[0] is an array of 5 ints and c[1] is another array of 5 ints.
The following code is valid, and relevant to your question...

int[] a = new int[4];
      int[] b = new int[6];
      int[][] c = new int[2][];
      c[0] = a;
      c[1] = b;

Edited by JamesCherrill: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.