0% found this document useful (0 votes)
11 views

Character class functions

The document outlines various functions of the Character class in Java, including methods to check if a character is lower case, upper case, a letter, a digit, or whitespace, as well as methods to convert between cases. Each function is described with its purpose, return type, and an example output. Additionally, it explains how to create a Character class object and mentions the default value of the character data type.

Uploaded by

tapansaha053
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Character class functions

The document outlines various functions of the Character class in Java, including methods to check if a character is lower case, upper case, a letter, a digit, or whitespace, as well as methods to convert between cases. Each function is described with its purpose, return type, and an example output. Additionally, it explains how to create a Character class object and mentions the default value of the character data type.

Uploaded by

tapansaha053
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Character class functions :

1) Character.isLowerCase() – This function is used to check whether the


given character is in small letter or not. Return type Boolean.

Ex. System.out.print(Charcater.isLowerCase(‘P’)); output : false.

2) Character.isUpperCase() – This function is used to check whether the


given character is in capital letter or not. Return type Boolean.

Ex. System.out.print(Charcater.isUpperCase(‘P’)); output : true.

3) Character.isLetter() – This function is used to check whether the given


character is an alphabet or not. Return type Boolean.

Ex. System.out.print(Charcater.isLetter(‘P’)); output : true.

4) Character.isDigit() – This function is used to check whether the given


character is a no or not. Return type Boolean.

Ex. System.out.print(Charcater.isDigit(‘9’)); output : true.

5) Character.isLetterOrDigit() – This function is used to check whether the


given character is an alphabet or a number or none of these. Return type
Boolean.

Ex. System.out.print(Charcater.isLetterOrDigit(‘P’)); output : true.

6) Character.isWhitespace() – This function is used to check whether the


given character is a space or not. Return type Boolean.

Ex. System.out.print(Charcater.isWhitespace(‘ ’)); output : true.


7) Character.toLowerCase() - This function is used to convert any upper case
letter to lower case. Return type character.

Ex. System.out.print(Charcater.toLowerCase(‘P’)); output : p.

8) Character.toUpperCase() - This function is used to convert any lower case


letter to upper case. Return type character.

Ex. System.out.print(Charcater.toUpperCase(‘x’)); output : X.

How to create character class object :

Character ob = new Character(‘p’);


Default value of character data type : ‘\u0000’

You might also like