title: How to make an if statement to check for if a String is greater than 10 characters
body: <p>So far I have been able to figure out how many characters are in the string, I can't seem to figure out an if statement to check if the character has more than 10 characters and if it does only display the first 10.</p>
  
  <pre><code>import java.text.*
  
  public class StringPracticeCoding
  
  {
   public static void main (String[] args)
  
     {
        //local constants
  
    //local variables
  
    //phrase input by the user
    String sentence = "I am somebody, I am worthy";
  
  
    /********************   Start main method  *****************/
  
    System.out.println("Length of String: " + sentence.length());
  
        System.out.println(sentence.substring(0,10));
  </code></pre>
  
  <p>yes it has to be an if statement</p>