title: Capitalize every word using Scanner(System.in) Java
body: <p>This code should allow the user to input a sentence, change it to lower case, and then capitalize the first letter of each word.  But I can't get the scanner to work, it just prints nothing.  Any suggestions?</p>
  
  <pre><code>public class Capitalize
  {
      public static void capCase(String theString)
      {
          String source = theString;
          StringBuffer res = new StringBuffer();
  
          char[] chars = theString.toLowerCase().toCharArray();
          boolean found = false;
          for(int i = 0; i&lt;chars.length; i++)
          {
              if(!found&amp;&amp; Character.isLetter(chars[i])){
                  chars[i] = Character.toUpperCase(chars[i]);
                  found = true;
              } else if (Character.isWhitespace(chars[i])){
                  found = true;
              }
          }
      }
  
      public static void main(String[] args)
      {
          Scanner scanner=new Scanner(System.in);
          System.out.println(scanner.next());
      }
  }
  </code></pre>