Convert String into Title Case
<p>I am a beginner in Java trying to write a program to convert strings into title case. For example, if <code>String s = "my name is milind"</code>, then the output should be <code>"My Name Is Milind"</code>.</p>

<pre><code>import java.util.*;
class TitleCase
{
public static void main(String args[])
{
    Scanner in = new Scanner(System.in);
    System.out.println("ent");

    String s=in.nextLine();
    String str ="";        
    char a ;

    for(int i =0;i&lt;s.length()-1;i++)
    {
        a = s.charAt(i);
        if(a==' ')
        {
            str = str+(Character.toUpperCase(s.charAt(i+1)));
        }
        else
        {
            str =str+(Character.toLowerCase(a));
        }

    }

    //for(int i =0; i&lt;s.length();i++)
    //{
        System.out.println(str);
    //}
}
}
</code></pre>