Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>These are the equivalences, bearing in mind that the size of a primitive data type in Java is always the same, whereas the size of a data type in C is to some extent compiler-and architecture-specific, as pointed by @millimoose in the comments.</p> <p>Also, be aware that the <code>char</code> data type is <a href="https://en.wikipedia.org/wiki/C_data_types#Basic_types" rel="nofollow">defined</a> as "smallest addressable unit of the machine that can contain basic character set. It is an integer type. Actual type can be either signed or unsigned depending on implementation", whereas in Java is a single 16-bit Unicode character.</p> <pre><code>long -&gt; long short -&gt; short char -&gt; char unsigned long -&gt; N/A unsigned short -&gt; N/A unsigned char -&gt; N/A byte -&gt; byte Int8 -&gt; byte Int16 -&gt; short Int32 -&gt; int UInt8 -&gt; N/A UInt16 -&gt; N/A UInt32 -&gt; N/A </code></pre> <p>In Java there are no unsigned primitive data types. The <code>byte</code> type uses 8 bits, <code>int</code> 32 bits, <code>short</code> 16 bits and <code>long</code> 64 bits.</p> <p>Here's a <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html" rel="nofollow">link</a> to the relevant section in the Java tutorial, and a more detailed explanation in <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.2" rel="nofollow">section §4.2</a> of the <a href="http://docs.oracle.com/javase/specs/jls/se7/html/index.html" rel="nofollow">Java Language Specification</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload