title: String index out of range, is there a proper way for comparing two strings?
body: <p>I have tried looking for the answer but as a beginner, there is only so much of java I can understand. I am trying to make the program be able to read individual chars and compare them with if statements. </p>
  
  <pre><code>    String Word1, Word2;
      char A1, A2, A3, A4, A5, A6, A7, A8, A9, A10; 
      char B1, B2, B3, B4, B5, B6, B7, B8, B9, B10; 
  </code></pre>
  
  <p>The strings must be from 6-10 characters so I made a bunch of chars, which I presume must be my problem as anything shorter than 10 will probably give me the Out of range issue. </p>
  
  <p>Could someone tell me the proper way to compare the strings? </p>