Think in java)

Source: Internet
Author: User

1. Everything is an object. Use a handle to operate the object.
The handle and object can be compared to the remote control and computer. Even if there is no TV, the remote control board can exist independently. An object does not have to be linked to a handle. Create a handle without initialization, an exception occurs. You have not created an object for it;
2. All objects must be created.
When creating an object, we want it to be connected to an object. Using the new Keyword, we create a new object;
2. 1. Where is the data stored?
1. Register: This is the fastest place to store, because it exists in a different place from other memory, inside the processor; (we have no control over the register, you cannot find the register shadow in the program );
2. Stack, which is located in the regular ram, but can be supported by the CPU through the stack pointer. A new memory is created when the stack pointer moves down, and a memory is released when the stack pointer moves up, this is a particularly fast and efficient storage method, which is second only to registers. java data must be stored here, especially the handle, where objects are not stored;
3. heap is a memory pool of conventional storage that stores java objects,
4. static storage: the static storage refers to the data that is stored at a fixed position. During the program running, the static storage data will be waiting for calling at any time. The static keyword can be used to indicate that a specific element of an object is static. However, Java objects are never placed in static buckets.
 
5. Others;
2.2 Special Cases and special types
Some Classes need to be specially treated and can be understood as basic or main types. They need to be frequently used during program design. This is especially true because the new object is not a special object, because the newly created object is placed in the heap, instead of using new to create a variable, instead, create an "automatic" variable that is not the handle. This variable contains specific values and is placed in the stack for more efficient access.
Java determines the size of each major type. Int char byte short long float double Type
2.3java Array
When creating an array, it is very likely that an array handle is created, and the array object is not actually created.

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.