title: How to convert a String to a 2D char array JAVA
body: <p>I am trying to convert a string into a 2D char array.</p>
  
  <p>So for example, if the input string is: <code>+dd+babd+b_a+ddc</code></p>
  
  <p>The output should be a 2D char array which looks like the following:</p>
  
  <pre><code>+dd+
  
  babd
  
  +b_a
  
  +ddc
  </code></pre>
  
  <p>The code below is what I have tried so far. Here I'm trying to get the character at index i and store it in a 2D char array at location [0][0] then the next character at location [0][1] and so on.</p>
  
  <p>[Please note, I added the @param comments in the looping body to help you understand what each of the parameters is storing. I understand the @param should be on top of the method head and not in the body].</p>
  
  <pre><code>public Board(String startConfig, String endConfig) {
  
          int row = 4;
          int column = 4;
          // @param startConfig currently stores the string +dd+babd+b_a+ddc.
          // @param endConfig is currently unused.
          char[][] boardArray = new char[row][column]; // Creates a 4x4 board.
          for (int i = 0; i &lt; row; i++) {
              for (int j = 0; j &lt; column; j++) {
                  boardArray[i][j] = startConfig.charAt(i);
                  System.out.println(boardArray[i][j]);
              }
          }
      }
  </code></pre>
  
  <p>I am truly stuck and can't think of anything else. I've already tried using .toCharArray but this method converts a string to a 1D char array, which is of little use to me.</p>
  
  <p>I want to thank you in advance for your time and help.</p>