Study: Learned this week
First: Loop statements
While statement "He will tell the compiler to execute a set of code repeatedly until a certain condition is met"
His grammatical form is: while (Boolean condition) {
The statement to be looped
}
do-while Statement "At least one loop must be executed"
Appropriate syntax: do{//execution Loop statement
}while (Boolean conditional type);
Small Summary: "While statement is to execute a Boolean condition, and then execute the Loop statement and the Do-while statement first ensure that the loop body at least one cycle"
For statement "is the most common, most used, and most typical loop statement"
Corresponding syntax: for (initialization statement; Boolean conditional; Iteration statement) {
Output PRINT Statement}
break jumps out of the loop when a condition is met
All of the above loops can jump out of the loop with break.
continue"If a loop is executed, one or several of them want to skip the loop. With continue can do "
Second: Array
。 Definition of an array (mainly one-dimensional arrays)
1. Static definition
Such as:
Int[] A = {n};
Student[] s = {new Student), New Student ()};
2. Dynamic definition
Such as:
Int[] A = new int[10];
Student[] s = new STUDENT[10];
。 Memory allocations for arrays
1. Although the base data type is not an object, an array of basic data types is an object, so memory allocation (one-dimensional array)
2. One-dimensional object array memory allocation
。 Multidimensional arrays
Multidimensional arrays can be thought of as a memory space stored in rows and columns. The number of elements on the row of a two-dimensional array can be different, but the elements on the column must be the same.
Int[][] A = new int[5[];
Note: The length property of the array, and the length of the string () method
。 Java.util.Arrays
This class contains various methods for manipulating arrays, such as sorting and searching. This class also contains a static factory that allows the array to be viewed as a list. Unless otherwise noted, the methods in this class will throw nullpointerexceptionIf the specified array reference is NULL.
Third: Methods
1. Java methods are similar to functions in other languages and are snippets of code used to accomplish a particular function, declaring the format:
Modifier 1 modifier 2 .... Returns the value type method name-.. The customary method name is the verb. (formal parameter list/)) {Java statement}, void is a special type of return value (no return value type),
2. The inside of a method cannot declare another method. Declare a new method that can only be placed in a class. But another method can be called in one method.
3, call Method: A, method name. B, argument (optional) argument (specific data type and variable name) C, return value (optional)
4. The method name, return type, and parameter list define the method signature, which is the signature that uniquely identifies the method.
5, java.lang.NullPointerException () 、、、 null pointer exception
6. Public: Indicates that the defined method is common and can be called in any program
7. The return type can be any data type or object type,
8. Pass by value:
9, System.exit (0); exit system
Life:
Met a lot of friends (they are full of passion every day.) ), which is also a great help to my lazy one.
This week's summary-Pontao