This java example shows how to convert a string into lowercase format. This is one good example on how to show on the basic usage of String API. Declaring a string can also be learned on this example. One of the fundamentals in learning java is on how to familiarize ourselves with the API’s available in java language. The following are things we could learn on the transformation of a string into lowercase example:

  • String object initialization and declaration
  • Usage of String toLowerCase() method
  • Basic java comments

Convert String into lowercase Java Example

Below is an example java code on how to convert a string in lower case format.

package com.javatutorialhq.java.examples;

import static java.lang.System.*;

 * This java example source code shows 
 * how to convert string into lowercase format  

public class StringLowerCaseConversion {

	public static void main(String[] args) {
		String stringExample = "This is a string example";
		out.println("Original String:"+stringExample);
		String lowercaseString = stringExample.toLowerCase();
		out.println("New String:"+lowercaseString);



String Convert Lower Case Sample Output

Running above java program will yield the following output

Original String:This is a string example
New String:this is a string example