How to Convert Strings to Uppercase and Lowercase in Java


In this example, we will learn the method to convert strings to uppercase and lowercase in Java.

Source Code

package com.beginner.examples;

public class UpperLower {
  public static void main(String[] args) {
    String str = "Good!";
    System.out.println(str.toUpperCase()); // convert strings to uppercase
    System.out.println(str.toLowerCase()); //convert strings to lowercase
  }
}

Output:

GOOD!
good!
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments