title: How would I sort a 2D array in Java?
body: <p>So I have a 2d array In Java that is a String</p>
  <pre class="lang-java prettyprint-override"><code>String a[][] = new String[3][4];
  a[0][0] = &quot;John&quot;;
  a[0][1] = &quot;Doe&quot;;
  a[0][2] = &quot;B&quot;;
  a[0][3] = &quot;999&quot;;
  a[1][0] = &quot;Bob&quot;;
  a[1][1] = &quot;Smith&quot;;
  a[1][2] = &quot;Q&quot;;
  a[1][3] = &quot;420&quot;;
  a[2][0] = &quot;Name&quot;;
  a[2][1] = &quot;Here&quot;;
  a[2][2] = &quot;T&quot;;
  a[2][3] = &quot;123&quot;;
  </code></pre>
  <p>How would I go about sorting the rows alphabetically?</p>
  <p>I tried <code>Arrays.sort(a)</code>, but it just threw back errors. And I feel like its gonna be more complicated that.</p>
  <p>The output should be:</p>
  <pre><code>Bob Smith Q 420
  John Doe B 999
  Name Here T 123
  </code></pre>
  <p>I already have the code for printing it working  properly, just need to sort it alphabetically by rows.</p>