Using 'toLowerCase( )' and 'toUpperCase( )' methods

toLowerCase( ) method is used to convert all the characters in the specified string from Upper case to Lower case.
toUpperCase( ) method is used to convert all the character in the specified string from Lower case to Upper case.

Examples:

"This is a Test Statement".toLowerCase( );  -> This will convert all the upper case letters in the specified string to lower case -> The resulting string after conversion will be "this is a test statement"

"This is a Test Statement".toUpperCase( );  -> This will convert all the lower case letters in the specified string to upper case -> The resulting string after conversion will be "THIS IS A TEST STATEMENT"

Lets implement this on Eclipse IDE:

1. Create 'toLowerCasetoUpperCaseDemo' class under any project as shown below:



2. Save and Run the 'toLowerCasetoUpperCaseDemo' class file
3. Observe that the output is displayed in the console as shown below:



Download this project:

Click here to download the project containing the class file used in this post (You can download this project and import into Eclipse IDE on your machine)