Java-preliminary Understanding-Common Object API (basic data type Object wrapper class-Overview)

Source: Internet
Author: User

One.

There are eight basic data types: Byte,short,int,long,float,double,char,boolean. In the world of Java, everything is object. To make it easier to manipulate the basic data type values, we encapsulate them in objects, and classes that describe the basic data types are called basic data type Object wrapper classes.

There are eight basic data types, which means there are eight wrapper classes.

The class name has a first-character capitalization feature, originally Byte,short,int ... Lowercase are keywords and are now being modified.

Of the eight classes, char and interger are changed, compared to the original words.

What is the use of these object wrapper classes?

(The range of byte is -27~27-1,-128~127)

For a variable of type int, it has a larger range of values. As a variable, the two best values of its range are not quite OK, but instead of the object, it is easy to get the maximum value by calling its own solution to the maximum value.

Then again, the Boolean type must not be converted to the object type class because of the value range. An example of this is why it is used as an object class: If you convert the decimal number to a binary number, this requires the object class of type Boolean. I've also introduced how to convert decimal numbers to binary numbers, but it's cumbersome, not so simple.

Java-preliminary Understanding-Common Object API (basic data type Object wrapper class-Overview)

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.