Java Programming/Keywords/char
From Wikibooks, open books for an open world
char is a keyword. It defines a character primitive type.
The java.lang.Character class is the nominal wrapper class when you need to store a char value but an object reference is required.
Syntax:
char <variable-name> = '<character>';
For example:
|
char oneChar1 = 'A';
char oneChar2 = 65; |
65 is the numeric representation of character 'A' , or its ASCII code.
|
System.out.println( oneChar1 );
System.out.println( oneChar2 ); |
outputs the following:
A A
See also:
This page may need to be