Java Program to capitalize each word in String
We can capitalize each word of a string by the help of split() and substring() methods. By the help of split("\\s") method, we can get all words in an array. To get the first character, we can use substring() or charAt() method.
Let's see the example to capitalize each word in a string.
My Name Is Khan I Am Sonoo Jaiswal