Page 348 - Computer science 868 Class 12
P. 348

Character.isUpperCase(char)                  This method returns true if the given argument is a
                                                                   capital letter, else returns false.
                      Character.isLowerCase(char)                  This method returns true if the given argument is a
                                                                   small letter, else returns false.
                      Character.toUpperCase(char)                  This method converts the character in the argument
                                                                   to capital letter, if found in small letter. This method
                                                                   returns a char value.

                      Character.toLowerCase(char)                  This method converts the character in the argument
                                                                   to small letter, if found in capital letter. This method
                                                                   returns a char value.
                      Character.isLetterOrDIgit(char)              This method returns true if the character passed in the
                                                                   argument is an alphabet or a digit, else return false.
                      Character.isWhitepace(char)                  This method returns true if the character passed in
                                                                   the argument is a space.

              Let us take some examples related to the above methods.

              •  System.out.println(Character.isLetter('A'));
                Output: true

              •  System.out.println(Character.isDigit('A'));
                Output: false
              •  System.out.println(Character.isLetterOrDigit(':'));
                Output: false
              •  System.out.println(Character.isUpperCase('A'));
                Output: true

              •  System.out.println(Character.isLowerCase('A'));
                Output: false

              •  System.out.println(Character.toUpperCase('b'));
                Output: B

              •  System.out.println(Character.toLowerCase('A'));
                Output: a


                  10.1 ASCII – AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE
              There are 256 characters that can be used to perform any task using the computer. All letters, digits and special
              characters fall under these 256 characters. Each character has an associate number which is known as ASCII Value of
              that character. The range of the ASCII value is from 0 to 255.
              Some of the important ASCII values of the characters that are used in Java are as follows:

                                              Characters                     ASCII Values

                                                A to Z                         65 to 90
                                                a to z                          97 to 122
                                                0 to 9                         48 to 56
              Apart from the above, ASCII values of some special characters are:
              •  Space (‘ ’)    -   32
              •  Period ‘.’   -   46
              •  Comma ‘,’   -   44



                346346  Touchpad Computer Science-XII
   343   344   345   346   347   348   349   350   351   352   353