Ext.: http://www.cnblogs.com/danne823/archive/2011/04/22/2025332.html
What is automatic packing unpacking
Automatic boxing (autoboxing), unpacking (unboxing) of the basic data type is a feature that has been available since J2SE
What is automatic packing unpacking
Automatic boxing (autoboxing), unpacking (unboxing) of the basic data type is a feature that has been available since J2SE 5.0.Generally we want to create an object instance of a class, we do this:Class A =
Autoboxing and auto-unboxing of J2SE primitive types
We know that in Java, the native type such as Int,long is not a class that inherits from object, so there are many operations that we cannot use primitive type operations, such as trying to put an
J2SE 1.5 provides the "autoboxing" and "auto-unboxing" mechanisms that allow compilers to automate the transformation between the base type and their wrapped objects, thus allowing for a simpler way to avoid some of the hassle of having two sets of
修正了所有已知的错误。增加了一份关于“Autoboxing/Auto-Unboxing”特性来源的背景资料。添加了一些关于“Autoboxing/Auto-Unboxing”特性增加了多少需要记住的规则的说明。/-->
You can read from the following addresses:
Http://blog.csdn.net/avius/archive/2004/07/29/55372.aspx
Major
Basic data typesA primitive type, or a built-in type, is a special type that differs from the class in Java. They are the most frequently used types in our programming.Java is a strongly typed language, and the first declaration of a variable must
Test code:System.out.println (0L = = 0);//trueSystem.out.println (((Long) 0L). Equals (0));//falseInteger i1 = 100;Integer i2 = 100;Integer i3 = 1000;//if the int values between-128 and 127,VM use the same object, the new object is created.Integer i4
We all know that after JDK 5 introduced the mechanism of automatic disassembly box, this is a good thing to write code. Integer object comparison between -128~127 these old stems do not mention, their own look at the source code can be understood,
Introduction to new features in JDK5.0:generic type (generics);Enhanced "for" loops (enhanced for loop);Automatic packing/automatic unpacking (autoboxing/unboxing);Type safety enumeration (type safe enums);Static import (statically import);Variable
There are 8 basic types of data in Java:Integer type: Byte (8), short (16), int (32), Long (64)Float type: float (32), double (64)Character type: char (16-bit Unicode character)Boolean type: BooleanAuto-unboxing is supported after jdk1.5Auto-Boxing
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.