Example 1: Java program to make the first letter of a String capital
Output
Name: nodmek
In the example, we have converted the first letter of the string name to upper case.
Example 2: Convert every word of a String to uppercase
Output
Message: Everyone Loves Java
Here,
- we have created a string named message
- we converted the string into a
chararray - we access every element of the
chararray - if the element is a white space, we convert the next element into uppercase