
Display tow dimensional array using one for loop in java

Display 2 dimensional array using Single Array
The given program displays the value of 2-d array using a single for loop.
import java.util.*;
class Display2dArrayUsingOneLoop{
public static void main(String[] args)
{
int[][] array = {{1,2},{3,4},{5,6}};
for (int[] arr : array) {
System.out.println(Arrays.toString(arr));
}
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.