How many bytes the Boolean type occupies in Java

Source: Internet
Author: User

Although the Java virtual machine defines a Boolean data type, it only provides very limited support. In a Java virtual machine, there are no bytecode directives dedicated to Boolean values, and operations involving Boolean values in the Java language are replaced with the int data type in the Java Virtual machine after compilation. A Java virtual machine directly supports an array of type Boolean, and the newarray instruction of the virtual machine can create such an array. The Boolean array type accesses and modifies the baload and Bastore directives that share an array of byte types.

In summary, a single Boolean is 4 bytes (since the mutation will be replaced with an int), while the boolean array is 1 bytes (because it is replaced by byte) ~ ~ ~

How many bytes the Boolean type occupies in Java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.