Make Two Dimensional Array Write Method Arrayholdermaker Takes Two Arrays Returns Array Ho Q37246658

How to make a two-dimensional array

Write a method, arrayHolderMaker(), that takes two arrays andreturns an array holder that is an array of the two arrays.

Given Code:

import java.util.Scanner;

public class Main {
//Write arrayHolderMaker here

public static void printArray(int [][] arrayTest){
for (int x = 0; x< arrayTest.length; x++){
for (int y = 0; y< arrayTest[x].length; y++){
System.out.print(arrayTest[x][y] + “, “);
}
System.out.print(‘n’);
}
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int a = 1 ;
while(a%2 != 0){
System.out.println(“please enter an even number”);
a = scnr.nextInt();
}
int[] array1 = new int[a/2];
int[] array2 = new int[a/2];
System.out.println(“Please enter ” + a + ” numbers”);
for(int x = 0; x < a/2; x++){
array1[x] = scnr.nextInt();
}
for(int x

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.