Thursday, 24 January 2013

Java Program to convert Lower Case Letter in to Uppper Case

Conversion of Lower Case letter to UpperCase in JAVA

toUpperCase(char ch) and toLowerCase(char ch) functions in Java


Syntax: public static char toUpperCase(char ch)


Converts the character argument to uppercase using case mapping information from the UnicodeData file. Note that Character.isUpperCase (Character.toUpperCase(ch)) does not always return true for some ranges of characters, particularly those that are symbols or
ideographs. In general, String.toUpperCase() should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.


Java Program to convert Lower Case Letter in to Upper Case


class LowerToUpperCase{
       public static void main(String args[]) {
              char smallLetter, bigLetter;
              smallLetter = 'b';
              bigLetter = Character.toUpperCase(smallLetter);
              System.out.println(bigLetter);
      }
}

Output:

B

No comments :

Post a Comment