×

Java String toLowerCase() methods

Java String toLowerCase() method is used to convert all the characters of the String into lower case.

Syntax:

public String toLowerCase()             
public String toLowerCase(Locale locale)

Returns:

It returns Lower case String

Java String toLowerCase() Example 1:

public class JavaStringtoLowerCaseEx1 {
    public static void main(String args[]) {
        String S1 = new String("UPPERCASE CONVERTED TO LOWERCASE");
        //Convert to LowerCase
        System.out.println(S1.toLowerCase());
    }
}

Output:

uppercase converted to lowercase

Java String toLowerCase() Example 2:

 public class JavaStringtoLowerCaseEx2
    { 
        public static void main(String[] args)
        { 
            String str  = " TUTORIAL AND EXAMPLE";
           System.out.println(str.toLowerCase());
            }
  }

Output:

tutorial and example

Java String toLowerCase() Example 3:

public class JavaStringtoLowerCaseEx3
    { 
        public static void main(String[] args)
        { 
            String str  = "tutorialandexample";
            String str2 = "TUTORIALANDEXAMPLE";      
           System.out.println(str2.toLowerCase().equals(str));
            }
  }

Output:

true

Java String toLowerCase(Locale locale) Method Example 4:

import java.util.Locale;
public class JavaStringtoLowerCaseEx4
{
    public static void main(String args[])
    {
        String s = "YOU LOVE PYTHON, BUT I LOVE JAVA.";
        // Locales with the language "tr" for TURKISH
        //"en" for ENGLISH is created
        Locale TURKISH = Locale.forLanguageTag("tr");
        Locale ENGLISH = Locale.forLanguageTag("en");
        // converting string s to lowercase letter
        // using TURKISH and ENGLISH language
        String S1 = s.toLowerCase(TURKISH);
        String S2 = s.toLowerCase(ENGLISH);
        System.out.println("In turkish language: "+S1);
        System.out.println("In English language: "+S2);
    }
}

Output:

In turkish language: you love python, but ? love java.
In English language: you love python, but i love java.

Related Topics

Java vs Golang

Java Java is both a programming language and a platform. Java is a high-level, dependable, object-oriented, and secure programming language. Java was developed in 1995 by Sun Microsystems, which is now an...

4 minutes read.

ArrayList vs Vector in Java

ArrayList Vs. Vector in Java In Java, the two classes ArrayList and Vector both are associated with Java Collections Framework. Both classes implement java.util.List interface. Even so, these classes have noticeable...

4 minutes read.

Java program to find frequency of characters in a string

In this article, you will understand the how to find the frequency of characters in strings by using Java programming language. Along with this, you will understand the hashing concept...

3 minutes read.

String Palindrome Program in Java

String Palindrome Program in Java The palindrome is a string, phrase, word, number, or other sequences of characters that can be read in both directions i.e. forward (left to right) and...

11 minutes read.

Rotate matrix by 90 degrees in Java | Rotate matrix in Java clockwise and anti-clockwise

In this article, you will be acknowledged about what is a matrix along with an example. Most importantly you will be equipped knowledge on how to rotate the matrix by...

4 minutes read.

String isnullorempty in Java

What do you mean by String? Strings are a collection of characters that are commonly used in Java programming. Strings are regarded as objects in the Java programming language. “String” is a...

4 minutes read.

Java Destructors

Before knowing about Java destructors, let us know about constructors. If we understand the concept of the constructor, we can easily understand about destructor and also, we will get an...

3 minutes read.

Bucket Sort in Java

Bucket Sort in JavaBucket sort is also called bin sort. Bucket sort first puts the elements of the array or list into different buckets. The first bucket contains elements of the smallest value. The...

11 minutes read.

Best Practices to use String Class in Java

Use String Builder or String Buffer for String concatenation in place of + operator.Compare two strings by equals( ) method instead == operator.Call .equals( ) method on a known String...

3 minutes read.

Int vs Integer in Java

In Java, numerical data can be stored using int or Integer. int and Integer both have different definitions but similar usage in Java. What is int in Java? int is a primitive...

4 minutes read.

Prime Number Program in Java Using a Scanner

In Java, a prime number is one that can only be divided by one or by itself and is greater than one. In other words, only one or itself can...

3 minutes read.

Java TreeMap

TreeMap in Java with Example Java TreeMap implements the NavigableMap interface. It extends Map Interface. Java TreeMap is based on the red-black Tree implementation. It stores the key-value pair in sorted...

7 minutes read.

Matrix Multiplication in Java

In Java, using the binary operator (*) we can perform matrix multiplication. A Matrix is a group of arrays. In the multiplication of matrices, the elements of each row are...

3 minutes read.

How to check the Java version in cmd

To make programs that can run on our systems, we need to install programming language-related software in our systems. Different programming languages require different types of software, aka IDEs (Integrated...

5 minutes read.

Minimum XOR value pair in Java

In this section, you will discuss about minimum XOR value pair in Java. The objective is to enforce a value that indicates the least XOR values of the two numbers from...

4 minutes read.

Program to Find Square Root of a Number Without sqrt Method in Java

The Java Math class sqrt () function can be used to determine the square root of a number. In this section, we'll write a Java program to find a number's...

3 minutes read.

Method and Block Synchronization in Java

The Synchronization is performed in multi-threading concept. The multi-threading is a concept of parallel running of a program for the execution. In the multi-threading concept, the threads are run by...

3 minutes read.

Java String copyValueOf() method

copyValueOf() method returns a String that holds the character sequence of the character array. Syntax: copyValueOf(char[] data) Parameters: data : the character array i.e. String Returns: It returns a String that contains the characters of the...

2 minutes read.

Find next greater number with same set of digits in Java

It contains a number (num). Finding the smallest number that has the same number of elements as num that is also larger than num is the task at hand. If...

8 minutes read.

Java file Reader

File Reader: It is used to read the data from files. This class inherits the properties from Input Stream Reader Class. File Reader is for reading characters from the file. Input Stream: Java.io...

4 minutes read.