Java wrapper class

Source: Internet
Author: User
Tags character classes

Java primitive Type is the basic data type of java.
There are 8 basic data types for Java: Byte (bytes), short (shorter integer), int (integer type), long (long), float (single-precision floating-point type), double (double-precision floating-point number Type), char (character type), Boolean (Boolean type )。
All except the 8 are objects, including arrays.

For example: Char is a basic data type (that is, the original data type) and string belongs to the object

Packaging class to from http://blog.csdn.net/hjf19790118/article/details/7081925

The Java language is an object-oriented language, but the basic data types in Java are not object-oriented, which in the actual use of a lot of inconvenience, in order to solve this shortcoming, in the design of the class for each basic data type to design a corresponding class to represent, The classes that correspond to the eight basic data types are collectively referred to as wrapper classes (Wrapper Class), and some are translated as outer or data type classes.

The wrapper classes are located in the Java.lang package, and the corresponding relationship between the wrapper class and the base data type is shown in the following table:

Wrapper class Correspondence Table

Basic data types

Packing class

Byte

Byte

Boolean

Boolean

Short

Short

Char

Character

Int

Integer

Long

Long

Float

Float

Double

Double

In these eight class names, except for the integer and character classes, the class name and the base data type of the other six classes have been all the time, only the first letter of the class name is capitalized.

For the wrapper class, the use of these classes consists of two main types:

A, as the basic data type corresponding to the class type exists, convenient to involve the operation of the object.

b, contains the relevant attributes for each basic data type, such as maximum, minimum, and related methods of operation.

Since the use of eight packaging classes is similar, the following is an example of the most commonly used integer class to describe the actual use of the wrapper class.

More Usage Reference manual http://www.runoob.com/java/number-parseint.html

Java wrapper class

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.