> For the complete documentation index, see [llms.txt](https://amartyushov.gitbook.io/tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amartyushov.gitbook.io/tech/programming-languages/java/types.md).

# Types

## Byte vs Char

| Byte                                 | Char                                                                               |
| ------------------------------------ | ---------------------------------------------------------------------------------- |
| Numeric data type                    | Numeric data type                                                                  |
| is used to store **raw binary data** | is used to store **characters or text data**                                       |
| -128 to 127                          | <p>0 to 65535<br>from <code>'\u0000'</code> to <code>'\uffff'</code> inclusive</p> |
| 8 bit                                | 16 bit                                                                             |

## Overview

<table><thead><tr><th width="138.33333333333331">Data Type</th><th width="125">Size</th><th>Description</th></tr></thead><tbody><tr><td><code>byte</code></td><td>1 byte</td><td>Stores whole numbers from -128 to 127</td></tr><tr><td><code>short</code></td><td>2 bytes</td><td>Stores whole numbers from -32,768 to 32,767</td></tr><tr><td><code>int</code></td><td>4 bytes</td><td>Stores whole numbers from -2,147,483,648 to 2,147,483,647</td></tr><tr><td><code>long</code></td><td>8 bytes</td><td>Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807</td></tr><tr><td><code>float</code></td><td>4 bytes</td><td>Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits</td></tr><tr><td><code>double</code></td><td>8 bytes</td><td>Stores fractional numbers. Sufficient for storing 15 decimal digits</td></tr><tr><td><code>boolean</code></td><td>1 bit</td><td>Stores true or false values</td></tr><tr><td><code>char</code></td><td>2 bytes</td><td>Stores a single character/letter or ASCII values</td></tr></tbody></table>
