Java has no "sizeof"

Source: Internet
Author: User

In C and C + +, the sizeof () operator satisfies one of our special needs: the number of characters assigned to the data item.

In C and C + +, the most common application of size () is "porting." Different data may have different sizes on different machines, so programmers have to be very aware of how big those types are when it comes to sizing operations.

For example, one computer can hold an integer with 32 bits, while the other is saved with only 16 bits. Obviously, in the first machine, the program can save a larger value. As you might have thought, porting is a problem that makes C and C + + programmers a pain in the neck.

Java does not need the sizeof () operator to meet this need, since all data types are the same size on all machines. We don't have to think about porting problems--java is itself a "platform-independent" language.

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.