toUpperCase() Java - How to convert lowercase to uppercase


toUpperCase() in Java

With the help of the toUpperCase() method, you can make letters capital. For example, the string with the text "Coding is fun" will be converted into "CODING IS FUN."


How To Call the Method:


If you run this code on your computer, you will see the following in the console: 


As you see, we have applied the method called toUpperCase() to 3 different Strings:

  • "I love Java"
  • "1 and 2 and 3"
  • "VERTEX"

As a result,

  • "I love Java" was converted into "I LOVE JAVA";
  • "1 and 2 and 3" was converted into  "1 AND 2 AND 3 ".
  • "VERTEX" initially was written in capital letters, that's why the method returned the same result -  "VERTEX".

* The method toUpperCase() also has another realization - with the parameter Locale. Later on we will write a separate article on this.

You can find more articles in our Java Tutorial for Beginners.


Самоучители--узнать детальнее--