title: I want to change the string of letters xxx-xxx-xxxx into 333-333-3333 I tried this but getting an error in the if(phoneNumber.charAt(0))
body: <pre><code>public class ABCTelephoneTranslator {
  
  public static String translate(String phoneNumber) {
       // Creating array of string length 
      char[] ch = new char[phoneNumber.length()]; 
  
      // Copy character by character into array 
      for (int i = 0; i &lt; phoneNumber.length(); i++) { 
          ch[i] = phoneNumber.charAt(i); 
      } 
     
      // Printing content of array 
      for (char c : ch) { 
          System.out.println(c); 
      }
      System.out.println(ch.length);
      if(ch.length &gt; 12) {
          throw new IllegalArgumentException(&quot;the format should be XXX-XXX-XXXX&quot;);
      }
      if(phoneNumber.charAt(0) == &quot;x&quot;) {
          phoneNumber.charAt(0) = &quot;3&quot;;
      }
      return phoneNumber;
  }
  </code></pre>
  <p>I need to change the string of letters xxx-xxx-xxxx into 333-333-3333 how do i do that I tried this but getting an error where it says if(phoneNumber.charat(0) == &quot;x&quot;) and below that please help me resolve this thank you</p>