Scanner java5 is a new feature of the Scanner class, we can use the Scanner class to get the basic syntax of user input: Scanner s = new Scanner (system.in) Obtains the input string from the next () and nextLine () methods of the Scanner class. Before reading, we usually need to use hasNext and hasNextLine () to determine whether there is any input data. Next (): 1. The next () method automatically removes whitespace encountered before entering valid characters. 3. 4. Next () does not yield the string nextLine () : 1 with a space. The nextLine () method returns all characters 2 before entering Enter. Can get blank 2. JAVA is the basic structure of the sequence structure, order structure unless otherwise specified, otherwise in accordance with the sequential order of execution of sentence by sentence structure is the simplest algorithm structure between the statement and the statement, between frame and frame was conducted according to the order from top to bottom, it is made up of several executed in sequence of processing steps, It is a basic algorithmic structure that no algorithm can do without. If (Boolean expression) {// The statement that will be executed if the Boolean expression is true} if () {if (Boolean expression) {// The statement that will be executed if the Boolean expression is true} if () {if (Boolean expression) {// The statement that will be executed if the Boolean expression is true} If (Boolean expression) {// statement that will be executed if Boolean expression is true}else (Boolean expression) {// Statement that will be executed if Boolean expression is false} if multi-select structure if () {}else if{}else if{}else An if structure that satisfies the entire end-of-statement nesting uses nested if… Else statements are legal, which means you can use an if or else if statement in another if or else if statement. You can nest else if…. as if statement The else syntax: If () {if () {}} switch case the switch case statement determines whether a variable is equal to a value in a set of values. Each value is called a branch. The variable type in the switch statement can be: Syntax: switch (expression) {case value: break; case value: break; While loop while () {} 1. The expression will continue as long as it is true. 2. Most cases will stop the loop, and we need an expression invalidation to end loop 3. Try not to let the program go through an endless loop

do… The while loop the do… Whil executes at least once do{}while() while doing… While do… While executes for at least once. For loops make some loop constructs simpler. For loops are general constructs that support some iterations, and are the most efficient and flexible syntax for loop constructs: In java5, for () {} introduced an enhanced for loop primarily for arrays, primarily for arrays and collections. Break & continue break is used to force out of a loop without executing any remaining statements. Continue is used to skip statements that have not yet been executed in a loop, Again judge the execution loop 6. practice