Convert Characters to Upper Case



To convert all lower case characters in a string to upper case, use the method toUpperCase() of the String class.
The example below shows how to use it. Note that the method returns a String so you’ll need to assign the return value of the method to a variable (in this case the same variable).

The result of the above code when executed:







Search for more Java info on this site here:
Custom Search


3 thoughts on “Convert Characters to Upper Case

    • Hi Scarlet,

      If the three last letters of a word should be uppercase and the rest lowercase it should look something like this. Note that the code assume that words that are three letters or less should be uppercase.

      The words are printed out one at each line, use System.out.print if you want them on the same line. Don’t forget to add a space between them.

Any thoughts or questions?