The Source for Java Technology Collaboration


Home | Help | Changes | Index | Search | Go

char (CharPrimitive)

The char primitive represents a 16 bit unsigned integral value. The Character object is a wrapper class for char.

All Java characters are in Unicode. If the nine most significant bits of a char are zero, the encoding is equivalent to seven bit ASCII.

Rules

  • A char can range in value from 0 to 216-1.
  • A char can be converted to an int, long, float or double without loss of information. This is known as a widening primitive conversion.
  • A char can be converted to a short or byte but only with an explicit cast and loss of information may result. This is known as a narrowing primitive conversion.
  • A char cannot be converted to a boolean.



Discussion about CharPrimitive

Topic CharPrimitive . { Edit | Ref-By | Printable | Diffs r1 | More }
 XML java.net RSS

Revision r1 - 09 Sep 2003 - 03:58:41 - Main.redwolf
Parents: WebHome > Glossary > Primitive