Think in Java Reading Notes 1

Source: Internet
Author: User

I. JVM
The constant pool is used in Java to save a copy of data in the compiled class file that has been determined during the compilation period. It includes constants in classes, methods, interfaces, and other fields, as well as string constants.
In addition to the constant values of various basic types (such as int and long) and object types (such as string and array) defined in the Code, it also contains some symbolic references that appear in the form of text, such:
Full qualified names of classes and interfaces;
Field name and descriptor;
Method and name and descriptor.

After the compiler compiles the source program into a class file, the bold code will be stored in a part of the byte classification. These bytes are called constant pools. In fact, only after the JVM loads the class, the space opened for them in the method area is more like a "pool ".

To use memory more effectively, when the constant pool encounters a string during compilation, it checks whether the same string already exists in the pool, point the reference of the new variable to the existing String object,
No new String constant object is created, and no new String constant object is created. Therefore, any modification to a string object will generate a new String object, which still exists, waiting for garbage collection.

2. All objects
1. Object-oriented features.
1) Everything is an object.
2) a program is a collection of objects.
3) each object has its own storage that is sufficient for other objects.
4) each object has its type.
5) all objects of a specific type can receive the same message.

2. The object has the status, behavior, and identifier.
*) Each object can have internal data (they provide the state of the object)
*) Each object can have a method (they produce behavior)
*) And each object has a unique address in the memory, which can be uniquely distinguished from other objects.

3. Process
1. Use of return, continue, and break

Outer:
While (){
For (){
Break; // (1)
Continue; // (2)
Continue outer; // (3)
Break outer; // (4)
}

}
(1) The Break interrupts the internal loop and returns to the External Loop.
(2) In, continue the execution point back to the starting point of the Internal Loop
(3) In, the continue outer interrupts both the internal and external loops and directly forwards them to the outer. In fact, it continues from the External Loop.
(4) The Break outer also interrupts all loops and returns to the outer, but does not re-enter the loop. Actually, two loops are completely aborted.

========= Fourth edition of Java programming ideology, download link ==============================

Http://download.csdn.net/detail/tzguo1314/5314416

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.