Some of the constants of the Character class in Java.
1. Character.BYTES
Syntax:
int java.lang.Character.BYTES
The number of bytes is used to represent a char value in unsigned binary form (i.e 2).
Approach:
Java
public class CharacterBYTES {public static void main(String[] args) {System.out.println(Character.BYTES);}}
Output:
2
2. Character.MAX_CODE_POINT
Syntax:
int java.lang.Character.MAX_CODE_POINT
The maximum value of a Unicode code point, constant U+10FFFF (i.e 1114111)
Approach:
Java
public class CharacterMaxCodePoint {public static void main(String[] args) {System.out.println(Character.MAX_CODE_POINT);}}
Output:
1114111
3. Character.MAX_HIGH_SURROGATE
Syntax:
char java.lang.Character.MAX_HIGH_SURROGATE : '�'
The maximum value of a Unicode high-surrogate code units in the UTF-16 encoding, constant '\u005CuDBFF'.A high-surrogate is also known as a leading surrogate.
Approach:
Java
public class CharacterMaxHighSurrogate {public static void main(String[] args) {System.out.println(Character.MAX_HIGH_SURROGATE);}}
Output:
?
Approach:
Java
public class CharacterMaxLowSurrogate {public static void main(String[] args) {System.out.println(Character.MAX_LOW_SURROGATE);}}
Output:
?
5. Character.MAX_RADIX
Syntax:
int java.lang.Character.MAX_RADIX : 36
The maximum radix is available for conversion to and from strings. The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.
Approach:
Java
public class CharacterMaxRadix {public static void main(String[] args) {System.out.println(Character.MAX_RADIX);}}
Output:
36
6. Character.MAX_SURROGATE
Syntax:
char java.lang.Character.MAX_SURROGATE: '�'
The maximum value of a Unicode surrogate code unit in theUTF-16 encoding, constant '\u005CuDFFF'.
Approach:
Java
public class CharacterMaxSurrogate {public static void main(String[] args) {System.out.println(Character.MAX_SURROGATE);}}
Output:
?
7. Character.LINE_SEPARATOR
Syntax:
byte java.lang.Character.LINE_SEPARATOR: 13
General category "Zl" in the Unicode specification.
Approach
Java
public class CharacterConstants7 {public static void main(String[] args) {System.out.println(Character.LINE_SEPARATOR);}}
Output:
13
8. Character.LOWERCASE_LETTER
Syntax:
byte java.lang.Character.LOWERCASE_LETTER: 2
General category "Ll" in the Unicode specification.
Approach
Java
public class CharacterConstants7 {public static void main(String[] args) {System.out.println(Character.LOWERCASE_LETTER);}}
Output:
2
Some more constants of Character class:
No comments:
Post a Comment