[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: byte, short and int



Excerpted from the Java Language Specification 2nd edition, section 4.2

"The integral types are byte, short, int, and long, whose values are 8-bit, 
16-bit, 32-bit and 64-bit signed two's-complement integers, respectively, 
and char, whose values are 16-bit unsigned integers representing Unicode 
characters.

The floating-point types are float, whose values include the 32-bit IEEE 
754 floating-point numbers, and double, whose values include the 64-bit 
IEEE 754 floating-point numbers."

For more details, refer to 
http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html

Internally, each JVM implementation may choose to map the Java types to 
whatever native types they want so long as no loss of precision and/or Java 
byte code portability occurs.

Jason

At 11:25 AM 9/19/2003 -0400, Huang, Xueqin wrote:
>Does JVM use the same memory space (4 bytes) for byte, short and int?
>The book "JAVA I/O" (Elliotte Rusty Harold) mentioned that "a single byte
>still takes up four bytes of space inside the Java virtual machine, ...". I
>guess a short may take 4 bytes too.