How to convert a String to uppercase

In this blog post, I will be explaining how you can convert a String to uppercase. Consider the following code snippet:

 

package learnjava.strings;public class StringUpperCaseDemo {public static void main(String[] args) {String str = "Hello World";str = str.toUpperCase();System.out.println(str);}}

 

There is a String.toUpperCase method. This converts the String object on which it is invoked to uppercase and returns the converted String. So when you run the above code, you will get the following output:

HELLO WORLD

Comments

Popular posts from this blog

How to use logging in SpringBoot with code samples

Python While Loop with code samples

How to convert a List to a Set