For undergraduate non-computer majors of cross-test, programming ability is still a certain lack of. Recently started contacting a Java engineering development (compile-and-test-related) project, and had little contact with Java before. Then began to learn the evil complement, record the two days reading the understanding of a few things, the most of their own study notes it.
1. Initialization loading order in Java:
When a static variable or method is decorated in a function with the static keyword, when the function is first instantiated or called (calling a static method), the static variable or method is initialized, followed by the construction method (if any), and then the remaining method is called.
A static variable or method is initialized only the first time it is called or the first class instance session, and subsequent calls are no longer initialized with the static variable.
2. The comparison between the second and C languages of arrays in Java
1) The assignment of an array in Java is simply an assignment of a reference (which can be understood as a pointer), after the assignment, two arrays point to the same block (the address of the array), the elements in the array are changed with one of the array names, and the elements of the array that the other array names point to change.
2) The assignment of array in C language is the assignment between two different regions (different array addresses), and it is not possible to assign values to arrays by connecting the array names directly with an equal sign, assigning the elements within the array to one another. (When changing an array of elements within an array, the other array is not changed)
Thinking in Java Learning Notes (i)