Java Example To Convert String To Uppercase And Lowercase

Hey guys!! How are you doing. Today we are going to learn java example to convert string to uppercase and lowercase.

Not something you do everyday. But occasionally when you are manipulating input from a user you will need to do that.

These methods that I will talk about here will show you how to set that up.

Well, converting java string from uppercase to lowercase is very straight forward. In java we have two inbuilt methods and they are,

  • toLowerCase()
  • toUpperCase()

Let’s see the code implementation,

Also Read – Convert Date To String Java Program

public class String_Change_Case {

public static void main(String[] args) {
String str_Convert = "Great Barrier Reef";
String convert_Lower = str_Convert.toLowerCase();
String convert_Upper = str_Convert.toUpperCase();
System.out.println("Before conversion - " + str_Convert);
System.out.println("\nAfter conversion - \n");
System.out.println("To Lowercase - " + convert_Lower);
System.out.println("To Uppercase - " + convert_Upper);




Java Example To Convert String To Uppercase And Lowercase

About the author


View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *