Java record-30-packaging class

Source: Internet
Author: User

Java record-30-packaging class
Wrapper Class is applicable to native data type packaging. 1. Java provides eight native data types. However, the object type needs to be used in many places during use, and the Native data type is not an object. In this case, you need to package the native data type into the object type for use. 2. Java provides packaging classes for all eight native data types. The packaging class object carries the specific native data type value. 3. We can operate native data types like using object-type operations. All packaging classes (8 types) are located under the java. lang package. 4. The eight packaging classes in Java are Byte, Short, Integer, Long, Float, Double, Character, and Boolean. They use the same method and can achieve two-way conversion between native data types and packaging types. Example: public static void main (String [] args) {int I = 3; Integer integer = new Integer (I); int ii = integer. intValue (); System. out. println (I = ii);} Class Integerjava. lang. objectjava. lang. numberjava. lang. integerAll Implemented Interfaces: Serializable, Comparable <Integer> public final class Integer extends Number implements Comparable <Integer> The Integer class wraps a value of the primitive type int in an object. an object of type Integer contains a single field whose type is int. in addition, this class provides several methods for converting an int to a String and a String to an int, as well as other constants and methods useful when dealing with an int. next article: http://www.bkjia.com/kf/201510/447459.html

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.