title: How to copy 2d String array?
body: <p>I'm having difficulty copying string array values into a new string array.</p>
  
  <p>For example:</p>
  
  <pre><code>String[][] array = new String[3][2];
  array[0][0] = "hello";
  array[0][1] = "1";
  array[1][0] = "guys";
  array[1][1] = "2";
  array[2][0] = "good ";
  array[2][1] = "3";
  
  array = new String [5][2];
  all the value in the first array to be copied
  array[3][0] = "";
  array........;
  </code></pre>
  
  <p>I tried this method but it keeps me giving null pointer issues whenever I want to insert a new value.</p>
  
  <pre><code>String[][] array = new String[3][2];
  array[0][0] = "olo";
  array[0][1] = "ada ";
  array[1][0] = "apa";
  array[1][1] = "dengan";
  array[2][0] = "si ";
  array[2][1] = "carlo";
  
  
  String[][] newArray = new String[5][2];
  newArray = Arrays.copyOf(array, 5);
  array = new String[5][2];
  array = Arrays.copyOf(newArray, 5);
  array[3][0] = "lo";
  array[3][1] = "gw";
  array[4][0] = "end";
  array[4][1] = "ennnnnd";
  
  for (int r = 0; r &lt; array.length; r++) {
      for (int c = 0; c &lt; array[r].length; c++) {
          System.out.print(" " + array[r][c]);
      }
      System.out.println("");
  }
  </code></pre>
  
  <p>How can I copy this 2d string array?</p>