hi,
Can anybody please explain me about "char" in Java. What is the significance of this datatype ?
If any ideas, please provide the information regarding this......thanks
hi,
Can anybody please explain me about "char" in Java. What is the significance of this datatype ?
If any ideas, please provide the information regarding this......thanks
'char' in Java refers to 'character'. The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.
In addition, this class provides several methods for determining a character's category (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase and vice versa.
Character information is based on the Unicode Standard, version 3.0. The methods and data of class Character are defined by the information in the UnicodeData file that is part of the Unicode Character Database maintained by the Unicode Consortium. This file specifies various properties including name and general category for every defined Unicode code point or character range.
In Java,
A char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. A char literal is a single one character enclosed in single quote marks is represented as -
char myCharacter = 'a';
Some characters are hard to type. For these Java provides escape sequences. The following escape sequences are defined:
\b backspace
\t tab
\n linefeed
\f formfeed
\r carriage return
\" double quote, "
\' single quote, '
\\ backslash,
Java provides an assistance to represent text as a combination of digits, letters, punctuation, words, sentences, and more through the Character, String, StringBuffer, and StringTokenizer classes. Java has a "character" datatype and "char" keyword to represent and manipulate characters.
Bookmarks