Java record-77-enhanced for loop and Automatic Disassembly box

Source: Internet
Author: User

Java record-77-enhanced for loop and Automatic Disassembly box
New features in JDK5.0: Generic (Generics); Enhanced "for" loop (Enhanced For loop); Autoboxing/unboxing ); type safe enums, Static import, variable parameters, and enhanced for loop: the addition of the For-Each loop simplifies the traversal of the set. Its syntax is as follows: For (type element: array) {System. out. println (element);} when traversing a set or array, if you need to access the subscript of the set or array, use the old method to achieve loop or traversal, instead of using an enhanced for loop, it loses the subscript information. Automatic packing/unpacking greatly facilitates basic data types and their packaging functions. Automatic packing: the basic type is automatically converted to the packaging class. (Int> Integer) Automatic unpacking: The packaging class is automatically converted to the basic type. (Integer> int)

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.