Java-Case Conversions

Case Conversions

As the Java language is case sensitive, it differentiates uppercase letters from lowercase letters. The String class provides two methods, namely toLowerCase( ) and toUpperCase( ) to facilitate case conversions. While the toLowerCase( ) method converts all the letters of the given string to lower case, the toUpperCase( ) method does just the opposite.

Program

final2


Program Source

public class Javaapp {

    public static void main(String[] args) {
       
        String str = new String("Welcome to Hajsoftutorial");

        System.out.println(str.toLowerCase());
        System.out.println(str.toUpperCase());
    }
}

Leave a Comment