Java.lang.String.toLowerCase() Method

Advertisements


Description

The java.lang.String.toLowerCase() method converts all of the characters in this String to lower case using the rules of the default locale.

Declaration

Following is the declaration for java.lang.String.toLowerCase() method

public String toLowerCase()

Parameters

  • NA

Return Value

This method returns the String, converted to lowercase.

Exception

  • NA

Example

The following example shows the usage of java.lang.String.toLowerCase() method.

package com.tutorialspoint;

import java.lang.*;

public class StringDemo {

  public static void main(String[] args) {
  
    // converts all upper case letters in to lower case letters
    String str1 = "Self Learning Center";
    System.out.println("string value = " + str1.toLowerCase());
    
    str1 = "www.photofuntoos.com";
    System.out.println("string value = " + str1.toLowerCase());
  }
}

Let us compile and run the above program, this will produce the following result:

string value = self learning center
string value = www.photofuntoos.com



Advertisements
Advertisements