Convert lowercase String to uppercase String in Java

toUpperCase() method of String class can be used to convert a lowercase string to uppercase string in Java.

toUpperCase() method returns a uppercase string after processing.


Example 1

class LcToUcTest{

public static void main(String args[]){

String lc="google";

String uc=lc.toUpperCase();

System.out.println("Uppercase string is "+uc);

}

}

Output 1

Uppercase string is GOOGLE


Example 2

class LcToUcTest{

public static void main(String args[]){

String cl="yahoo";

String uc=cl.toUpperCase();

System.out.println("Uppercase string is "+uc);

}

}

Output 2

Uppercase string is YAHOO