
- Java.lang - Home
- Java.lang - Boolean
- Java.lang - Byte
- Java.lang - Character
- Java.lang - Character.Subset
- Java.lang - Character.UnicodeBlock
- Java.lang - Class
- Java.lang - ClassLoader
- Java.lang - Compiler
- Java.lang - Double
- Java.lang - Enum
- Java.lang - Float
- Java.lang - InheritableThreadLocal
- Java.lang - Integer
- Java.lang - Long
- Java.lang - Math
- Java.lang - Number
- Java.lang - Object
- Java.lang - Package
- Java.lang - Process
- Java.lang - ProcessBuilder
- Java.lang - Runtime
- Java.lang - RuntimePermission
- Java.lang - SecurityManager
- Java.lang - Short
- Java.lang - StackTraceElement
- Java.lang - StrictMath
- Java.lang - String
- Java.lang - StringBuffer
- Java.lang - StringBuilder
- Java.lang - System
- Java.lang - Thread
- Java.lang - ThreadGroup
- Java.lang - ThreadLocal
- Java.lang - Throwable
- Java.lang - Void
- Java.lang Package Useful Resources
- Java.lang - Useful Resources
- Java.lang - Discussion
Java - Character isAlphabetic() Method
The Java Character isAlphabetic() method accepts a valid Unicode code point as an argument, and checks whether the corresponding code point character is an alphabet or not.
A character is said to be Alphabetic if its general category type specified in the Unicode system belongs to any of the following −
UPPERCASE_LETTER
LOWERCASE_LETTER
TITLECASE_LETTER
MODIFIER_LETTER
OTHER_LETTER
LETTER_NUMBER
The Other_Alphabetic contributory property as defined by the Unicode Standard.
Syntax
Following is the syntax of the Java Character isAlphabetic() method
public static boolean isAlphabetic(int codePoint)
Parameters
codePoint − The Unicode code point to be tested.
Return Value
The method returns a Boolean value true if the code point is an alphabetical character, false if not.
Checking a CodePoint to be an Alphabet Example
The following example shows the usage of Java Character isAlphabetic() method. We've created an int variable and assigned it a codepoint value. Now using isAlphabetic() method, we're checking if the int value represents a alphabet or not.
package com.tutorialspoint; public class isAlphabeticDemo { public static void main(String args[]) { int cp; Boolean b; cp = 0x0043; b = Character.isAlphabetic(cp); System.out.println("Is the given code point alphabetic? " + b); } }
Output
If we compile and run the program above, the output is displayed as follows −
Is the given code point alphabetic? True
Checking a CodePoint to be an Alphabet Example
The following example shows the usage of Java Character isAlphabetic() method. We've created an int variable and assigned it a codepoint value. Now using isAlphabetic() method, we're checking if the int value represents a alphabet or not.
As the given code point argument is not an alphabetic character, the method returns false.
package com.tutorialspoint; public class isAlphabeticDemo { public static void main(String args[]) { int cp; Boolean b; cp = 0x0012; b = Character.isAlphabetic(cp); System.out.println("Is the given code point alphabetic? " + b); } }
Output
If we compile and run the program above, the output is displayed as follows −
Is the given code point alphabetic? False
Checking a CodePoint to be an Alphabet Example
The following example shows the usage of Java Character isAlphabetic() method. We've created an int variable and assigned it a codepoint value. Now using isAlphabetic() method, we're checking if the int value represents a alphabet or not.
Since the return value of this method is of Boolean type, the method can be used as a condition to the conditional statements. If the return value is true, if statement is executed and if the return value is false, else is executed.
package com.tutorialspoint; public class isAlphabeticDemo { public static void main(String args[]) { int cp; Boolean b; cp = 0x0087; b = Character.isAlphabetic(cp); if(b) System.out.println("The given code point is alphabetic"); else System.out.println("The given code point is not alphabetic"); } }
Output
The output for the given program is as follows −
The given code point is not alphabetic