首页 > 其他 > 详细

Autoboxing an autounboxing in genral

时间:2015-10-16 16:53:43      阅读:188      评论:0      收藏:0      [点我收藏+]

AutoBoxing and unboxing are features added in Java 5 to work with primitive data types and their corresponding wrapper classes. They are implemented completely in the compiler

Note the amount of code needed just to add two int values. Wrapping/unwrapping an int value to an Integer and vice versa is just a pain for Java developers. Java designers realized it (though too late) and they automated this wrapping and unwrapping process for you.

The automatic wrapping from a primitive data type (byte, short, int, long, float, double, char and boolean) to its corresponding wrapper object (Byte, Integer, Long, Float, Double, Character and Boolean) is called autoboxingThe reverse, unwrapping from wrapper object to its corresponding primitive data type, is called unboxing.


Tip Autoboxing/unboxing is performed when you compile the code. The JVM is completely unaware of the boxing and unboxing performed by the compiler.

Autoboxing an autounboxing in genral

原文:http://www.cnblogs.com/glf2046/p/4885417.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!