Google News
logo
Java String to Lower Case
toUpperCase() and toLowerCase()
String toLowerCase(): This method converts all the characters of the string into lower case, and returns the lower-cased string.
Example: String str1 = HELLO;
System.out.println(str1.toLowerCase());
Output: hello

String toUpperCase(): This method converts all the characters of the string into upper case, and returns the upper-cased string. 

Example: String str1 = hello ;
System.out.println(str1.toUpperCase()); 

Output: HELLO
toUpperCase() and toLowerCase():-
class Test 
{ 
public static void main(String[] args) 
{ 
String str="freetmielearn HOW R U"; 
System.out.println(str.toUpperCase()); 
System.out.println(str.toLowerCase()); 
System.out.println("FREETIMELEARN ".toLowerCase()); 
} 
}
Output :
FREETIMELEARN HOW R U, freetmielearn how r u, freetmielearn