First, commissioning
Step 1: Set a breakpoint (you cannot set a breakpoint in an empty space)
Step 2: Start debugging
Step 3: Debug code (F6 Single Step) notebook Fn+f6 (F5)
Step 4: End Debugging
Mastering the benefits of debugging?
Clearly see that the order in which the code is executed
Quickly navigate to where the exception code appears and help modify or refine the code
Second, while loop
1, the advantages of the cycle?
Reduce the coding of repetitive code, the program will be more concise
2. Grammar
while (expression) {
1. The expression is a "loop condition" and the result must be a Boolean type
2, the code in {}, that is, "loop operation (body)"
3. "Iteration section" changes the loop condition to end the loop
}
3, Characteristics: First judge, then execute
4. While loop has 2 common ways
Mode 1: "P98 page--Example code 5"
while (1, loop condition: Determines whether strings are equal) {
2. Cyclic operation
3. Receive the string in the keyboard again, change the loop condition, to end the loop
}
Method 2: "P97 page Example 4 code"
while (1, loop condition: int variable combined with relational operator for comparison) {
2. Cyclic operation
3, iteration part, int variable + + or--, to change the loop condition, end the loop operation
}
Third,Do....while cycle
1, applicable occasions: first cycle 1 times, according to the conditions of judgment, recycling
2. Grammar
do{
2. Circulating body (cyclic operation)
3. Change the cycle condition
}while (conditions); 1. Cyclic conditions
Java Learning (v)