Home Java Java-conversion Alphabet Character Case-Converter
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Alphabet Character Case-Converter

Advertisement
In this section, you will learn to convert a character (uppercase) into a lowercase character.

Alphabet Character Case-Converter

     

In this section, you will learn to convert a character (uppercase) into a lowercase character. The java.lang package provides the functionality to convert the uppercase character into a lowercase character. 

Code Description:

The following program helps you in converting a uppercase character (R) into a lowercase character (r). Program takes a character (uppercase) at the console and it converts it  into a lowercase character using the  toLowerCase() method. This method converts the  uppercase character into  the lowercase character and returns converted lowercase character. 

Here is the code of this program:

import java.io.*;
import java.lang.*;

  public class CharToLowercase{
  public static void main(String args[]) throws IOException{
  BufferedReader buff = 
 
new BufferedReader(new InputStreamReader(System.in));
  System.out.println("Enter the uppercase character:");
  String s = buff.readLine();
  char c = s.charAt(0);
  char lower = Character.toLowerCase(c);
  System.out.println("Lowercase character: " + lower);
  }
  }

Download this program:

Output of this program.

C:\corejava>java CharToLowercase
Enter the uppercase character:
R
Lowercase character: r
C:\corejava>
Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 15, 2007

Ask Questions?    Discuss: Alphabet Character Case-Converter   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
MOHANRAJ NR
April 12, 2011
java

public class FirstLetter{ public static void main(String[] args) throws IOException { // FileInputStream f1=new FileInputStream(""); String s1=" hi my name is mohan",arr[]; arr=s1.split(" "); for (int i = 0; i < arr.length; i++) { //System.out.println(arr[i]); if(arr[i].length()!=0) { for (int j = 0; j < arr[i].length(); j++) { if(j==0) { System.out.print(Character.toUpperCase(arr[i].charAt(0))); } else { System.out.print(arr[i].charAt(j)); } } } System.out.print(" "); } } }
Daniel Benjamin
November 4, 2011
Java codings

Pls how can i write the codes in java how to convert a string to character. Thanks
Ashish
November 14, 2011
Error in the program

import java.io.*; import java.lang.*; public class CharToLowercase{ public static void main(String args[]) throws IOException{ BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the uppercase character:"); String s = buff.readLine(); char c = s.charAt(0); char lower = Character.toLowerCase(c); System.out.println("Lowercase character: " + lower); } } /* hey there is the error in the program javalower.java:9: toLowerCase(char) in java.lang.Character cannot be applied to (java.lang.String) char lower = Character.toLowerCase(name);
subodh kumar
January 24, 2012
good website

good website
DMCA.com