Java: Convert a given string into lowercase
Java Basic: Exercise-59 with Solution
Write a Java program to convert a string into lowercase.
Pictorial Presentation: String to Lowercase

Sample Solution:
Java Code:
import java.util.*;
public class Exercise59 {
public static void main(String[] args) {
// Create a Scanner object for user input
Scanner in = new Scanner(System.in);
System.out.print("Input a String: ");
// Read a string from the user
String line = in.nextLine();
// Convert the string to lowercase
line = line.toLowerCase();
// Print the lowercase version of the input string
System.out.println(line);
}
}
Sample Output:
Input a String: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog.
Flowchart:

Java Code Editor:
Previous: Write a Java program to capitalize the first letter of each word in a sentence.
Next: Write a Java program to find the penultimate (next to last) word of a sentence.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join