Java series Learning (6)-array and java series learning Array
1. Method:
(1) Definition:
Code that completes a specific functional block, also called a function in some languages
(2) format:
(3) method Overloading
[In the same class, the method name is the same, the parameter list is different, and it is irrelevant to the return value]
2. Array
(1) Definition
Containers that store multiple elements of the same data type
(2) features:
Each element has a number starting from 0. The maximum number is: array length-1;
The professional name of the number: Index
(3) format:
A: Data Type [] array name (recommended)
B: data type array name []
(4) array initialization:
A: Dynamic Initialization
[Only the length and coefficient are given with the default value]
B: static Initialization
[Given value, the system determines the length]
C: it cannot be performed dynamically or statically at the same time. An error is reported.
(5) Java Memory Allocation
A: Stack, storage value type, or reference address. Data disappears after use.
B: Heap. It stores all new objects.
[Every variable in the heap has a default value
Byte, short, int, long: 0
Float, double: 0.0
Char: '\ u0000'
Boolean: false
Reference Type: null]
C: Method Area, storing local variables in brackets
D: local method area, related to the system
E: registers, CPU usage
(6) Common Operations on Arrays
A: array Traversal
B: obtain the maximum/small value from the array.
C: array element reverse order
D: array lookup Method
E: array sorting and Binary Search
3. Two-dimensional array
(1) Definition:
The element is an array of one-dimensional arrays.
(2) format:
(3) case:
A: traversal of two-dimensional arrays
B: summation of two-dimensional arrays
C: Yang Hui triangle
(4) schematic diagram