Java Character Class
javaIn Java, the java.lang.Character
class is a wrapper class that represents a single Unicode character. It provides
methods for working with characters, such as checking the character’s type, converting the character to a string, and
comparing characters.
Here are some common methods of the Character
class:
char charValue()
: Returns the primitive char
value represented by this Character
object.
boolean isLetter()
: Determines whether the specified character is a letter.
boolean isDigit()
: Determines whether the specified character is a digit.
boolean isWhitespace()
: Determines whether the specified character is a whitespace character.
boolean isUpperCase()
: Determines whether the specified character is an uppercase character.
boolean isLowerCase()
: Determines whether the specified character is a lowercase character.
char toUpperCase(char ch)
: Converts the specified character to uppercase.
char toLowerCase(char ch)
: Converts the specified character to lowercase.
Here is an example of how to use the Character
class:
char c = 'A';
Character ch = c; // ch is a Character object with the value 'A'
boolean b1 = ch.isLetter(); // b1 is true
boolean b2 = ch.isDigit(); // b2 is false
boolean b3 = ch.isWhitespace(); // b3 is false
boolean b4 = ch.isUpperCase(); // b4 is true
boolean b5 = ch.isLowerCase(); // b5 is false
char c2 = ch.toLowerCase(c); // c2 is 'a'
Other Article on Tag java
- - after and before in java date
- - am pm java date format
- - apk minecraft java edition
- - as been blocked by CORS policy Response to preflight request doesn't pass access control check It does not have HTTP ok status
- - bubble sort in java
- - Can I compile and run a spring boot jar from inside another spring boot application
- - convert java date to localdate
- - design patterns in java
- - encrypt by java and decrypt by node
- - exception handling in java