Instantiation Secrets for Java wrapper classes

Source: Internet
Author: User
Instantiation of wrapper classes
All the packaging classes are immutable.
Instantiation method:
Construction method
In addition to the character class, other packages


Integer (int x)
Integer (String x)
NumberFormatException exception


The parameters for the Boolean constructor method are not distinguished


Uppercase and lowercase


Two construction methods are provided for the installation class
static method: ValueOf () method
Integer i=integet.valueof (200);
Integer i=integet.valueof (200,8);
8 indicates the binary


The difference between the construction method and the valueof ()
The New keyword always creates an object
The ValueOf () method is cached in the 128 to 127


Number of integers (byte,short,int,long




Instantiation Secrets for Java wrapper classes

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.