[Java self-learning focus] Basics

Source: Internet
Author: User

1. arrays are used to store data of the same data type. Once Initialization is complete, the occupied space is fixed. Even if an element is cleared, its space is retained, therefore, the array length cannot be changed.


II:Java does not have the keyword foreach. Its syntax is for (type item: items), but foreach can only be used to traverse element values and cannot be changed.


III:The array reference variables are stored in the stack memory (stack), and the array elements are stored in the heap memory (heap ).

650) this. width = 650; "class =" decoded "alt =" http://www.bkjia.com/uploads/allimg/131228/161035F96-0.jpg "src =" http://www.bkjia.com/uploads/allimg/131228/161035F96-0.jpg "/>

IV:Array and Arrays

Array is a class in JAVA reflection. It only has a private constructor and cannot be directly instantiated. This class provides methods for dynamically creating and accessing Java arrays.

Arrays is a tool class in java. util. It contains various methods used to operate Arrays, such as sorting and searching. This class also contains a static factory that allows you to view arrays as a list. Arrays has a well-known method, that is, sort reloads many methods to sort Arrays, while another asList method can convert Arrays into collection objects. This set is of the Arrays $ ArrayList type, but it is never an ArrayList. Use instanceof to judge whether the returned value is false. Note that the asList parameter must be an array.

V:Collection and Collections

Collection is an interfaceCollection <E>Extends <E> it is highly abstracted from many methods in the Collection, so other entity classes that implement it are a specific implementation of methods in the Collection interface.

Collections is also a tool set, which is composed of static methods that operate on the collection or return the collection. It contains the polymorphism algorithm operated on the collection, that is, the package, which returns the new collection supported by the specified collection and a few other contents.



This article from the "CEO Road" blog, please be sure to keep this source http://zhaohaibo.blog.51cto.com/7808533/1286474

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.