Numeric Values Representation in Java: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:
There are five integral primitive types in Java: [[Java_Language#byte|byte]], [[Java_Language#short|short]], [[Java_Language#int|int]], [[Java_Language#long|long]] and [[Java_Language#char|char]]. Of those, the first four (<code>byte</code>, <code>short</code>, <code>int</code> and <code>long</code>) are signed, and <code>char</code> is unsigned.
There are five integral primitive types in Java: [[Java_Language#byte|byte]], [[Java_Language#short|short]], [[Java_Language#int|int]], [[Java_Language#long|long]] and [[Java_Language#char|char]]. Of those, the first four (<code>byte</code>, <code>short</code>, <code>int</code> and <code>long</code>) are signed, and <code>char</code> is unsigned.


<code>byte</code> values used one-byte (8 bites) and they are represented in two's complement.
<code>byte</code> is the smallest integral data type available in Java. Its values used one-byte (8 bites) and they are represented in two's complement.


==Floating Point Primitive Type==
==Floating Point Primitive Type==

Revision as of 23:08, 5 April 2020

Internal

Overview

Primitive Types

Integral Primitive Type

There are five integral primitive types in Java: byte, short, int, long and char. Of those, the first four (byte, short, int and long) are signed, and char is unsigned.

byte is the smallest integral data type available in Java. Its values used one-byte (8 bites) and they are represented in two's complement.

Floating Point Primitive Type

TODO