Boxing is simply converting primitive type to Wrapper class. e.g. Integer skip bj = new INTEGER (100). autoboxing is compiler taking care of boxing. With autoboxing following is a legal statement:Integer required bj = 100;
Vice-versa is called
J2SE autoboxing
As any Java programmer knows, you can ' t put an int (or other primitive value) into a collection. Collections can only hold object references, so you have to box primitive values into the appropriate wrapper class (which is Integer
The last error in the original reference resource should be:
The Jakarta commons primitives component provides a set of container classes dedicated to saving basic types of data. Compared with using Java Collection framework and
Original link: https://docs.oracle.com/javase/tutorial/java/data/autoboxing.htmlFirst, autoboxingAutoboxing is an automatic conversion feature from the original type to the corresponding wrapper type (wrapper classes) provided by the Java compiler.
修正了所有已知的错误。增加了一份关于“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
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
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 =
Author: gnuhpcSource: http://www.cnblogs.com/gnuhpc/
Import Java. util. arraylist; public class autoboxing {public static void main (string [] ARGs) {// manually packed to solve the problem that the container class cannot place basic data types
After the Java SE 1.5 release and later, the automatic boxing feature is available.Auto-boxing, "wrapping" the underlying type into one type:Basic Type-wrapper classThe following procedure triggers an automatic boxing process:Integer count =
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.