title: How to use String.format() in Java to replicate tab "\t"?
body: <p>I'm printing data line by line and want it to be organized like a table.</p>
  
  <p>I initially used <code>firstName + ", " + lastName + "\t" + phoneNumber</code>.</p>
  
  <p>But for some of the larger names, the phone number gets pushed out of alignment</p>
  
  <p>I'm trying to use String.format() to achieve this effect. Can anyone tell me the format syntax to use?</p>
  
  <p>I tried <code>String.format("%s, %s, %20s", firstName, lastName, phoneNumber)</code>, but that's not what I want. I want it to look like this:</p>
  
  <p>John, Smith&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;123456789</p>
  
  <p>Bob, Madison&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;123456789</p>
  
  <p>Charles, Richards &nbsp;123456789</p>
  
  <p>Edit:
  These answers seem to work for System.out.println(). But I need it to work for a JTextArea. I'm using textArea.setText()</p>
  
  <p>Worked it out. JTextArea doesn't use monospaced fonts by default. I used setFont() to change that, and now it works like a charm. Thank you all for the solutions.</p>