
i want print two array in following format first array= 1,2,3,4,5,6,7,8,9 second array=11,12,13,14,15,16,17,18,19
i want output as:
1 2 3 11 12 13 4 5 6 14 15 16 7 8 9 17 18 19

Here is a code that displays the array values in the following pattern:
1 2 3 11 12 13
4 5 6 14 15 16
7 8 9 17 18 19
class DisplayArray
{
public static void main(String[] args)
{
int array1[]= {1,2,3,4,5,6,7,8,9};
int array2[]={11,12,13,14,15,16,17,18,19};
int rows = 3;
int columns = 3;
for (int row = 0; row < rows; row++) {
for (int column = 0; column < columns; column++) {
System.out.print(array1[row * columns + column]+" ");
}
System.out.print(" ");
for (int column = 0; column < columns; column++) {
System.out.print(array2[row * columns + column]+" ");
}
System.out.println();
}
}
}
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.