Thoughtinshare Source: Http://www.cnblogs.com/thoughtInShare Welcome reprint, Please also keep this statement. Thank you!
1, Process Control = sequential Structure + branching structure + loop structure
(1) Branch structure =if+switch
(2) Loop structure =while+do while () +for
(3) Control loop structure =break (end entire cycle) +continue (end this cycle) +return (end the entire method)
(4) Return is not specifically used to control the loop structure,return function is to end a method ; Regardless of how many loops the return is in;
An array of 2,java is a type;
(1) After the initialization of the array, the space occupied in memory will be fixed;
(2) The array is a reference type, such as int[] is a data type, similar to the int,string type, can also be used to define variables;
(3) define an array:
Type[] arrayname; (recommended)
Type arrayname[];
An array is a reference-type variable that, when used to define a variable, simply means that a reference variable is defined, that is, a pointer is defined, but does not point to any valid memory, so the array length cannot be specified when the array is defined because there is no valid memory space to store the array elements;
(4) Initialization of array elements = allocating memory space + assigning initial value
Static initialization: The initial value of each array element is explicitly specified, and the array length is determined by the system; Be careful not to specify the array length and the initial value of the element when initializing the array;
Syntax: arrayname = new Type[]{element1,element2,element3,...};
Dynamic initialization: The programmer specifies the length of the array, and the system assigns the initial values;
Syntax: Arrayname = new Type[length];
(5) Arrays are reference array types, array references are just a reference, array elements and arrays of variables are stored separately in memory;
The data area of the runtime is called the heap area, where the actual array object is stored in heap memory, and if the reference variable is a local variable, it is stored in stack memory;
(6) About stack memory and heap memory differentiation
When a method runs, the method builds its own memory theatre, the variables defined in this method are placed in the stack memory one by one, and as the method executes, the memory stack of the method is destroyed naturally, so the local variables defined in all the methods are placed in the stack memory;
When we create an object, this object is stored in the running data area to be reused, the data area of the runtime is the heap memory, and the object of heap memory is not destroyed with the end of the method;
Only when an object does not have any reference variable to reference it, the garbage collection period of the system will be recycled at the appropriate time;
(7) Manipulating arrays of tool classes, Arrays;
Java Process Control and arrays