04.01_java Language Basics (circular structure overview and for statement formats and their use)
04.02_java Language Basics (the practice of looping structures for statements get data)
- A: Case Demo
- Requirements: Please output data in the console 1-10
- Requirements: Please output data in the console 10-1
- B: Precautions
- A: Determines whether a conditional statement is a Boolean type, either simple or complex.
- B: Loop body statement If it is a statement, the curly braces can be omitted, and in the case of multiple statements, the curly braces cannot be omitted. Never omit the suggestion.
- C: Generally speaking: there is no semicolon on the left curly brace, there is no left brace for the semicolon
04.03_java Language Foundation (the summation idea of the practice of circular structure for statement)
- A: Case Demo
- Requirements: Finding the sum of data between 1-10
- B: Student Practice
- Requirements: Find the number of even numbers between 1-100 and
- Requirements: Find out between 1-100 odd and
04.04_java Language Foundation (cyclic structure for statement of practice Narcissus)
04.05_java Language Foundation (statistical idea of the practice of circular structure for statements)
- A: Case Demo
- Requirements: Statistics of "narcissus number" total number of
04.06_java Language Foundation (format and basic use of the loop structure while statement)
04.07_java Language Foundation (practice of loop structure while statement)
- A: Summation thought
- B: Statistical Ideas
- Count the number of daffodils.
04.08_java Language Basics (format and basic use of circular structure do...while statements)
04.09_java Language Foundation (the difference between circular structures of three circular statements)
- A: Case Demo
- The difference between the three circular statements:
- The Do...while loop executes at least one loop body.
- The For,while cycle must first determine whether the condition is true, and then decide whether to execute the Loop body statement.
- B: Case Demo
- The difference between a for loop and a while loop:
- A: If you want to continue using the variable that controls the condition after the loop is over, use the while loop, otherwise use the For loop. I don't know who to use for loop. Because variables disappear early from memory, you can improve the efficiency of memory usage.
04.10_java Language Foundation (cycle of circular structure considerations)
- A: Must pay attention to control the condition statement control the problem of the variable, do not lose, otherwise it is easy to die cycle.
- B: Two of the simplest dead loop formats
- while (true) {...}
- for (;;) {...}
04.11_java Language Foundation (loop structure loop nesting output 4 rows 5 columns of stars)
A: Case Demo
- B: Conclusion:
- Outer loop control number of rows, inner loop control number of columns
04.12_java Language Foundation (cyclic structure loop nested output positive triangles)
04.13_java Language Foundation (Loop structure 99 multiplication table)
04.14_java language Base (Control jump statement break statement)
04.15_java language Base (Control jump statement continue statement)
- A:continue Usage Scenarios
04.16_java Language Basics (Control of jump statement labels)
- Label: Mark a loop to control it
- Label composition rule: is actually a valid identifier
04.17_java Language Basics (Control adjustment statement exercises)
04.18_java language Base (Control jump statement return statement)
- The role of A:return
- Return
- In fact, its function is not to end the loop, but to end the method.
- B: Case Demo
- What is the difference between return and break and continue?
- Return is the End method
- Break is jumping out of the loop
- Continue is to terminate this cycle and continue the next cycle.
04.19_java Language Basics (Method overview and format description)
04.20_java Language Foundation (method summation case and its invocation)
- A: How to write a method
- 1, explicit return value type
- 2, clear parameter list
- B: Case Demo
- Requirements: two cases of data
- C: Method Invocation Plot
04.21_java Language Basics (Method Considerations)
- A: Method invocation (with a specific return value)
- A: Call alone, generally no meaning, so not recommended.
- B: The output is called, but not good enough. Because we may need to do further work on the results.
- C: Assignment invocation, recommended scenario.
- B: Case Demo
- A: Method does not call do not execute
- B: Methods and methods are lateral relationships, cannot be nested defined
- C: When the method is defined, the arguments are separated by commas
- D: Do not pass the data type at the time of method invocation
- E: If the method has a definite return value, be sure to have return with a value
04.22_java Language Basics (practice of methods)
- A: Case Demo
- Requirements: Keyboard input two data, return two number of large values
- B: Case Demo
- Requirements: Keyboard input Two data, compare two number is equal
04.23_java Language Basics (method's output star and its invocation)
- A: Case Demo
- Requirements: Based on the number of rows and columns entered by the keyboard, the output star in the console
- B: Method Invocation: (no return value, void)
- called separately
- Output Call (Error)
- Assignment Invocation (Error)
04.24_java Language Basics (practice of methods)
- A: Case Demo
- Requirements: Data output According to the keyboard input the corresponding multiplication table
04.25_java Language Basics (Method overloading overview and basic usage)
- A: Overview of method overloading
- Summation case
- 2 integers
- 3 integers
- 4 integers
B: Method Overloading:
In the same class, the method name is the same, and the parameter list is different. Is independent of the return value type.
The parameter list is different:
- A: Different number of parameters
- B: Different parameter types
- C: The order of the parameters is different (overloaded, but not in development)
04.26_java Language Basics (method overloading exercises compare data for equality)
- A: Case Demo
- Requirement: Compare two data for equality.
- parameter types are two int type, two double type, and are tested in the Main method
4th Loop Structure Overview and the format of the for statement and its use